Pod::S...:Pandoc(3pm)
π Pod::Simple::Pandoc β the manual, but make it cute π
okay bestie, you're reading the man page for Pod::Simple::Pandoc(3pm), from the User Contributed Perl Documentation collection. sit down, hydrate, we're converting Pod to Pandoc and we're gonna slay it. β¨
β¨ NAME β¨
Pod::Simple::Pandoc β convert Pod to Pandoc document model π¦
π SYNOPSIS π
use Pod::Simple::Pandoc;
my $parser = Pod::Simple::Pandoc->new( %options );
my $doc = $parser->parse_file( $filename );
# result is a Pandoc::Document object
my $json = $doc->to_json;
my $markdown = $doc->to_pandoc( -t => 'markdown' );
$doc->to_pandoc(qw( -o doc.html --standalone ));
that's it. that's the whole vibe. copy-paste it, you're welcome. π
πΈ DESCRIPTION πΈ
So basically, this module converts Pod format (perlpod) into the document model used by Pandoc <http://pandoc.org/>. The way that it works is you get a result you can poke at with methods from Pandoc::Elements, and then hand off to Pandoc to turn it into literally any other document format you want (HTML, Markdown, LaTeX, PDF, EPUB, docx, ODT, manβ¦) π₯
Also, go look at pod2pandoc and App::pod2pandoc if you want a command line script and a simplified API to this module. no cap, they're right there. π«Ά
π OPTIONS π
parseβ parse Pod data sections with Pandoc and merge them into the document, instead of just passing them along as a"RawBlock". use"*"to parse all formats supported by pandoc as input format. otherwise it expects an array reference. πpodurlβ base URL to link Perl module names to. default is <https://metacpan.org/pod/>. a false value disables linking external modules and wraps module names in"Span"elements instead. all module names are marked up with class"perl-module". π
π METHODS π
parse_file( $filename | *INPUT )
Reads Pod from a file or filehandle and converts it into a Pandoc::Document. The filename gets put into the document metadata field "file" and the module name. And the NAME section, if it's given, is additionally split into the metadata fields "title" and "subtitle". π
parse_module( $module )
Reads Pod from a module given by name such as "Pod::Pandoc" or by URL. π
parse_string( $string )
Reads Pod from a string and converts it to a Pandoc::Document. Also sets the metadata fields "title" and "subtitle". β¨
parse_dir( $directory )
Recursively looks for ".pm" and ".pod" files in a given directory and parses them. Returns a hash reference with filenames mapped to Pandoc::Document objects. Each document is enriched with the metadata field "base" (the relative path from each file to the base directory) on top of "file", "title", and "subtitle". π¦
parse_modules( $directory, [ quiet => 0|1 ] )
Same as the "parse_dir" method, except it returns a Pod::Simple::Pandoc::Modules instance that maps module names to Pandoc::Document instances. The source directory can also be specified with the option "source". The option "quiet" disables warnings for skipped files. π€«
parse_and_merge( @files_or_modules )
Reads Pod from files or modules given by name and merges them into one Pandoc::Document by concatenation. π«Ά
π§ MAPPING π§
Pod elements are mapped to Pandoc elements as following:
β¨ Formatting codes β¨
Formatting codes for italic text ("I<...>"), bold text ("B<...>"), and code ("C<...>") are mapped to Emphasized text ("Emph"), strongly emphasized text ("Strong"), and inline code ("Code"). Formatting codes for filenames ("F<...>") are mapped to inline code with class "filename" (`...`{.filename} in Pandoc Markdown). Formatting codes inside code and filenames (like "code with bold", or <http://example.org/> as a filename) are stripped to unformatted code. Character escapes ("E<...>") and "S<...>" are directly mapped to Unicode characters. The special formatting code "X<...>" is ignored. π
π Links π
Some examples of links of different kinds:
<http://example.org/>
pod2pandoc
"OPTIONS" in pod2pandoc
perl(1)
"ENVIRONMENT" in crontab(5)
hell itself!
Link text can contain formatting codes:
the "pod2pandoc" script
"MAPPING"
mapping from PoD to Pandoc
Titles may contain formatting "codes"!
π Lists π
- Numbered lists are
- converted to
"NumberedList"and- Bulleted lists are
- converted to
"BulletList"
Definition Lists are also supported. π
π― =over/=back π―
An "=over"β¦"=back" region containing no "=item" is mapped to "BlockQuote". π
π§ Verbatim sections π§
verbatim sections are mapped
to code blocks
π¦ Data sections π¦
Data sections are passed as "RawBlock". "HTML", "LaTeX", "TeX", and "tex" are recognized as aliases for "html" and "tex". π¦
The option "parse" can be used to parse data sections with the pandoc executable and merge them into the result document. β¨
π SEE ALSO π
This module is based on Pod::Simple (Pod::Simple::SimpleTree). It makes obsolete several specialized "Pod::Simple::..." modules such as Pod::Simple::HTML, Pod::Simple::XHTML, Pod::Simple::LaTeX, Pod::Simple::RTF Pod::Simple::Text, Pod::Simple::Wiki, Pod::WordML, Pod::Perldoc::ToToc etc. π
okay that's the whole page bestie, go forth and convert π this was perl v5.32.1, dated 2022-01-20, and it lives at Pod::S...:Pandoc(3pm). mwah π periodt. πβ¨
π¦ where this page comes from
- debian bookworm: libpod-pandoc-perl 0.5.0-3 Β· GPL-2.0-only
- debian trixie: libpod-pandoc-perl 0.5.0-3 Β· GPL-2.0-only
- ubuntu jammy: libpod-pandoc-perl 0.5.0-3 Β· GPL-2.0-only
- ubuntu noble: libpod-pandoc-perl 0.5.0-3 Β· GPL-2.0-only
- ubuntu resolute: libpod-pandoc-perl 0.5.0-3 Β· GPL-2.0-only
- ubuntu stonking: libpod-pandoc-perl 0.5.0-3 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms