.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Pod::Markdown 3pm" .TH Pod::Markdown 3pm "2020-11-04" "perl v5.30.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Pod::Markdown \- Convert POD to Markdown .SH "VERSION" .IX Header "VERSION" version 3.300 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& # Pod::Simple API is supported. \& \& # Command line usage: Parse a pod file and print to STDOUT: \& # $ perl \-MPod::Markdown \-e \*(AqPod::Markdown\->new\->filter(@ARGV)\*(Aq path/to/POD/file > README.md \& \& # Work with strings: \& my $markdown; \& my $parser = Pod::Markdown\->new; \& $parser\->output_string(\e$markdown); \& $parser\->parse_string_document($pod_string); \& \& # See Pod::Simple docs for more. .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module uses Pod::Simple to convert \s-1POD\s0 to Markdown. .PP Literal characters in Pod that are special in Markdown (like *asterisks*) are backslash-escaped when appropriate. .PP By default \f(CW\*(C`markdown\*(C'\fR and \f(CW\*(C`html\*(C'\fR formatted regions are accepted. Regions of \f(CW\*(C`markdown\*(C'\fR will be passed through unchanged. Regions of \f(CW\*(C`html\*(C'\fR will be placed inside a \f(CW\*(C`
\*(C'\fR tag so that markdown characters won't be processed. Regions of \f(CW\*(C`:markdown\*(C'\fR or \f(CW\*(C`:html\*(C'\fR will be processed as \s-1POD\s0 and included. To change which regions are accepted use the Pod::Simple \s-1API:\s0 .PP .Vb 2 \& my $parser = Pod::Markdown\->new; \& $parser\->unaccept_targets(qw( markdown html )); .Ve .SS "A note on encoding and escaping" .IX Subsection "A note on encoding and escaping" The common Pod::Simple \s-1API\s0 returns a character string. If you want Pod::Markdown to return encoded octets, there are two attributes to assist: \*(L"match_encoding\*(R" and \*(L"output_encoding\*(R". .PP When an output encoding is requested any characters that are not valid for that encoding will be escaped as \s-1HTML\s0 entities. .PP This is not 100% safe, however. .PP Markdown escapes all ampersands inside of code spans, so escaping a character as an \s-1HTML\s0 entity inside of a code span will not be correct. However, with pod's \f(CW\*(C`S\*(C'\fR and \f(CW\*(C`E\*(C'\fR sequences it is possible to end up with high-bit characters inside of code spans. .PP So, while \f(CW\*(C`output_encoding => \*(Aqascii\*(Aq\*(C'\fR can work, it is not recommended. For these reasons (and more), \f(CW\*(C`UTF\-8\*(C'\fR is the default, fallback encoding (when one is required). .PP If you prefer \s-1HTML\s0 entities over literal characters you can use \&\*(L"html_encode_chars\*(R" which will only operate outside of code spans (where it is safe). .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" .Vb 1 \& Pod::Markdown\->new(%options); .Ve .PP The constructor accepts the following named arguments: .IP "\(bu" 4 \&\f(CW\*(C`local_module_url_prefix\*(C'\fR .Sp Alters the perldoc urls that are created from \f(CW\*(C`L<>\*(C'\fR codes when the module is a \*(L"local\*(R" module (\f(CW"Local::*"\fR or \f(CW"Foo_Corp::*"\fR (see perlmodlib)). .Sp The default is to use \f(CW\*(C`perldoc_url_prefix\*(C'\fR. .IP "\(bu" 4 \&\f(CW\*(C`local_module_re\*(C'\fR .Sp Alternate regular expression for determining \*(L"local\*(R" modules. Default is \f(CW\*(C`our $LOCAL_MODULE_RE = qr/^(Local::|\ew*?_\ew*)/\*(C'\fR. .IP "\(bu" 4 \&\f(CW\*(C`man_url_prefix\*(C'\fR .Sp Alters the man page urls that are created from \f(CW\*(C`L<>\*(C'\fR codes. .Sp The default is \f(CW\*(C`http://man.he.net/man\*(C'\fR. .IP "\(bu" 4 \&\f(CW\*(C`perldoc_url_prefix\*(C'\fR .Sp Alters the perldoc urls that are created from \f(CW\*(C`L<>\*(C'\fR codes. Can be: .RS 4 .IP "\(bu" 4 \&\f(CW\*(C`metacpan\*(C'\fR (shortcut for \f(CW\*(C`https://metacpan.org/pod/\*(C'\fR) .IP "\(bu" 4 \&\f(CW\*(C`sco\*(C'\fR (shortcut for \f(CW\*(C`http://search.cpan.org/perldoc?\*(C'\fR) .IP "\(bu" 4 any url .RE .RS 4 .Sp The default is \f(CW\*(C`metacpan\*(C'\fR. .Sp .Vb 1 \& Pod::Markdown\->new(perldoc_url_prefix => \*(Aqhttp://localhost/perl/pod\*(Aq); .Ve .RE .IP "\(bu" 4 \&\f(CW\*(C`perldoc_fragment_format\*(C'\fR .Sp Alters the format of the url fragment for any \f(CW\*(C`L<>\*(C'\fR links that point to a section of an external document (\f(CW\*(C`"section" in name\*(C'\fR). The default will be chosen according to the destination \*(L"perldoc_url_prefix\*(R". Alternatively you can specify one of the following: .RS 4 .IP "\(bu" 4 \&\f(CW\*(C`metacpan\*(C'\fR .IP "\(bu" 4 \&\f(CW\*(C`sco\*(C'\fR .IP "\(bu" 4 \&\f(CW\*(C`pod_simple_xhtml\*(C'\fR .IP "\(bu" 4 \&\f(CW\*(C`pod_simple_html\*(C'\fR .IP "\(bu" 4 A code ref .RE .RS 4 .Sp The code ref can expect to receive two arguments: the parser object (\f(CW$self\fR) and the section text. For convenience the topic variable (\f(CW$_\fR) is also set to the section text: .Sp .Vb 1 \& perldoc_fragment_format => sub { s/\eW+/\-/g; } .Ve .RE .IP "\(bu" 4 \&\f(CW\*(C`markdown_fragment_format\*(C'\fR .Sp Alters the format of the url fragment for any \f(CW\*(C`L<>\*(C'\fR links that point to an internal section of this document (\f(CW"section"\fR). .Sp Unfortunately the format of the id attributes produced by whatever system translates the markdown into html is unknown at the time the markdown is generated so we do some simple clean up. .Sp \&\fBNote:\fR \f(CW\*(C`markdown_fragment_format\*(C'\fR and \f(CW\*(C`perldoc_fragment_format\*(C'\fR accept the same values: a (shortcut to a) method name or a code ref. .IP "\(bu" 4 \&\f(CW\*(C`include_meta_tags\*(C'\fR .Sp Specifies whether or not to print author/title meta tags at the top of the document. Default is false. .IP "\(bu" 4 \&\f(CW\*(C`escape_url\*(C'\fR .Sp Specifies whether or not to escape URLs. Default is true. It is not recommended to turn this off with an empty local_module_url_prefix, as the resulting local module URLs can be confused with IPv6 addresses by web browsers. .SS "html_encode_chars" .IX Subsection "html_encode_chars" A string of characters to encode as html entities (using \*(L"encode_entities\*(R" in HTML::Entities if available, falling back to numeric entities if not). .PP Possible values: .IP "\(bu" 4 A value of \f(CW1\fR will use the default set of characters from HTML::Entities (control chars, high-bit chars, and \f(CW\*(C`<&>"\*(Aq\*(C'\fR). .IP "\(bu" 4 A false value will disable. .IP "\(bu" 4 Any other value is used as a string of characters (like a regular expression character class). .PP By default this is disabled and literal characters will be in the output stream. If you specify a desired \*(L"output_encoding\*(R" any characters not valid for that encoding will be \s-1HTML\s0 entity encoded. .PP \&\fBNote\fR that Markdown requires ampersands (\f(CW\*(C`&\*(C'\fR) and left angle brackets (\f(CW\*(C`<\*(C'\fR) to be entity-encoded if they could otherwise be interpreted as html entities. If this attribute is configured to encode those characters, they will always be encoded. If not, the module will make an effort to only encode the ones required, so there will be less html noise in the output. .SS "match_encoding" .IX Subsection "match_encoding" Boolean: If true, use the \f(CW\*(C`=encoding\*(C'\fR of the input pod as the encoding for the output. .PP If no encoding is specified, Pod::Simple will guess the encoding if it sees a high-bit character. .PP If no encoding is guessed (or the specified encoding is unusable), \&\*(L"output_encoding\*(R" will be used if it was specified. Otherwise \f(CW\*(C`UTF\-8\*(C'\fR will be used. .PP This attribute is not recommended but is provided for consistency with other pod converters. .PP Defaults to false. .SS "output_encoding" .IX Subsection "output_encoding" The encoding to use when writing to the output file handle. .PP If neither this nor \*(L"match_encoding\*(R" are specified, a character string will be returned in whatever Pod::Simple output method you specified. .SS "local_module_re" .IX Subsection "local_module_re" Returns the regular expression used to determine local modules. .SS "local_module_url_prefix" .IX Subsection "local_module_url_prefix" Returns the url prefix in use for local modules. .SS "man_url_prefix" .IX Subsection "man_url_prefix" Returns the url prefix in use for man pages. .SS "perldoc_url_prefix" .IX Subsection "perldoc_url_prefix" Returns the url prefix in use (after resolving shortcuts to urls). .SS "perldoc_fragment_format" .IX Subsection "perldoc_fragment_format" Returns the coderef or format name used to format a url fragment to a section in an external document. .SS "markdown_fragment_format" .IX Subsection "markdown_fragment_format" Returns the coderef or format name used to format a url fragment to an internal section in this document. .SS "include_meta_tags" .IX Subsection "include_meta_tags" Returns the boolean value indicating whether or not meta tags will be printed. .SS "escape_url" .IX Subsection "escape_url" Returns the boolean value indicating whether or not URLs should be escaped. .SS "format_man_url" .IX Subsection "format_man_url" Used internally to create a url (using \*(L"man_url_prefix\*(R") from a string like \f(CWman(1)\fR. .SS "format_perldoc_url" .IX Subsection "format_perldoc_url" .Vb 2 \& # With $name and section being the two parts of L. \& my $url = $parser\->format_perldoc_url($name, $section); .Ve .PP Used internally to create a url from the name (of a module or script) and a possible section (heading). .PP The format of the url fragment (when pointing to a section in a document) varies depending on the destination url so \*(L"perldoc_fragment_format\*(R" is used (which can be customized). .PP If the module name portion of the link is blank then the section is treated as an internal fragment link (to a section of the generated markdown document) and \*(L"markdown_fragment_format\*(R" is used (which can be customized). .SS "format_fragment_markdown" .IX Subsection "format_fragment_markdown" Format url fragment for an internal link by replacing non-word characters with dashes. .SS "format_fragment_pod_simple_xhtml" .IX Subsection "format_fragment_pod_simple_xhtml" Format url fragment like \*(L"idify\*(R" in Pod::Simple::XHTML. .SS "format_fragment_pod_simple_html" .IX Subsection "format_fragment_pod_simple_html" Format url fragment like \*(L"section_name_tidy\*(R" in Pod::Simple::HTML. .SS "format_fragment_metacpan" .IX Subsection "format_fragment_metacpan" Format fragment for metacpan.org (uses \*(L"format_fragment_pod_simple_xhtml\*(R"). .SS "format_fragment_sco" .IX Subsection "format_fragment_sco" Format fragment for search.cpan.org (uses \*(L"format_fragment_pod_simple_html\*(R"). .SS "is_local_module" .IX Subsection "is_local_module" Uses \f(CW\*(C`local_module_re\*(C'\fR to determine if passed module is a \*(L"local\*(R" module. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 pod2markdown \- script included for command line usage .IP "\(bu" 4 Pod::Simple \- Super class that handles Pod parsing .IP "\(bu" 4 perlpod \- For writing \s-1POD\s0 .IP "\(bu" 4 perlpodspec \- For parsing \s-1POD\s0 .IP "\(bu" 4 \- Markdown spec .SH "SUPPORT" .IX Header "SUPPORT" .SS "Perldoc" .IX Subsection "Perldoc" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc Pod::Markdown .Ve .SS "Websites" .IX Subsection "Websites" The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources. .IP "\(bu" 4 MetaCPAN .Sp A modern, open-source \s-1CPAN\s0 search engine, useful to view \s-1POD\s0 in \s-1HTML\s0 format. .Sp .SS "Bugs / Feature Requests" .IX Subsection "Bugs / Feature Requests" Please report any bugs or feature requests by email to \f(CW\*(C`bug\-pod\-markdown at rt.cpan.org\*(C'\fR, or through the web interface at . You will be automatically notified of any progress on the request by the system. .SS "Source Code" .IX Subsection "Source Code" .PP .Vb 1 \& git clone https://github.com/rwstauner/Pod\-Markdown.git .Ve .SH "AUTHORS" .IX Header "AUTHORS" .IP "\(bu" 4 Marcel Gruenauer .IP "\(bu" 4 Victor Moral .IP "\(bu" 4 Ryan C. Thompson .IP "\(bu" 4 Aristotle Pagaltzis .IP "\(bu" 4 Randy Stauner .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" .IP "\(bu" 4 Aristotle Pagaltzis .IP "\(bu" 4 Cindy Wang (CindyLinz) .IP "\(bu" 4 Graham Ollis .IP "\(bu" 4 Mike Covington .IP "\(bu" 4 motemen .IP "\(bu" 4 moznion .IP "\(bu" 4 Peter Vereshagin .IP "\(bu" 4 Ryan C. Thompson .IP "\(bu" 4 Yasutaka \s-1ATARASHI\s0 .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2011 by Randy Stauner. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.