NAME

Text::AsciidocDown::Refs - Reference index and link rewriting for AsciiDoc

SYNOPSIS

use Text::AsciidocDown::Refs;

my $idx = Text::AsciidocDown::Refs::new_index();
Text::AsciidocDown::Refs::register_heading($idx, $attrs, $title);
my $output = Text::AsciidocDown::Refs::rewrite_links($idx, $markdown);

DESCRIPTION

This module maintains a cross-reference index for AsciiDoc section headings and rewrites internal xref links (#!target) to their resolved anchors. It is not intended for direct use; callers should use the OO interface provided by Text::AsciidocDown.

INTERFACE

new_index

my $idx = Text::AsciidocDown::Refs::new_index();

Creates a new, empty reference index.

register_heading

Text::AsciidocDown::Refs::register_heading($idx, $attrs, $title, $explicit_id, $reftext);

Registers a heading in the reference index for later xref resolution.

resolve_target

my $entry = Text::AsciidocDown::Refs::resolve_target($idx, $target);

Looks up a target (by ID or title) in the reference index.

my $output = Text::AsciidocDown::Refs::rewrite_links($idx, $markdown);

Rewrites internal xref markers (#!target) to resolved heading anchors.

AUTHOR

Sandor Patocs

LICENSE

Same terms as Perl itself.