Text::MarkdownAdoc

Project Description

Text::MarkdownAdoc is a pure Perl converter that transforms Markdown documents into clean AsciiDoc output suitable for use with Asciidoctor.

The primary target dialect is GitHub-Flavored Markdown (GFM) plus kramdown extensions (definition lists, footnotes). Pure CommonMark is also supported as a subset.

This project is inspired by kramdown-asciidoc (a Ruby reference implementation) and is designed for round-trip compatibility with Text::AsciidocDown (AsciiDoc → Markdown).

Installation

perl Makefile.PL
make
make test
make install

Requirements

Usage

Library API

use Text::MarkdownAdoc;

my $converter = Text::MarkdownAdoc->new(
    attributes => { 'toc' => 'auto' },
);

my $asciidoc = $converter->convert($markdown_text, {
    attributes => { 'imagesdir' => 'img' },
});

CLI

# Convert file to sibling .adoc
markdown-adoc input.md

# Output to stdout
markdown-adoc -o - input.md

# Read from stdin, write to stdout
echo "# Hello" | markdown-adoc -

# Set attributes
markdown-adoc -a toc=auto -a imagesdir=img input.md

# Enable auto-generated heading IDs
markdown-adoc --auto-ids input.md

Supported Markdown Features

Known Limitations

 produce the expected AsciiDoc output due to overlapping delimiter handling
 simple word-boundary constraints are used for italic detection

Intentionally Unsupported Features

Round-trip Compatibility

This project is designed for round-trip compatibility with Text::AsciidocDown: AsciiDoc → Markdown (via Text::AsciidocDown) → AsciiDoc (via Text::MarkdownAdoc) should produce no data loss. See COMPATIBILITY_REPORT for current status.

Reference Implementation

kramdown-asciidoc serves as the reference implementation for conversion behavior and test scenarios. The scenario files (.md + .adoc pairs) in that repository are a valuable reference for expected conversion output.

License

This module is licensed under the same terms as Perl itself.