new
Pod::Markdown->new(%options);
The constructor accepts the following named arguments:
• "local_module_url_prefix"
Alters the perldoc urls that are created from "L<>" codes when the module is a "local" module
("Local::*" or "Foo_Corp::*" (see perlmodlib)).
The default is to use "perldoc_url_prefix".
• "local_module_re"
Alternate regular expression for determining "local" modules. Default is "our $LOCAL_MODULE_RE =
qr/^(Local::|\w*?_\w*)/".
• "man_url_prefix"
Alters the man page urls that are created from "L<>" codes.
The default is "http://man.he.net/man".
• "perldoc_url_prefix"
Alters the perldoc urls that are created from "L<>" codes. Can be:
• "metacpan" (shortcut for "https://metacpan.org/pod/")
• "sco" (shortcut for "http://search.cpan.org/perldoc?")
• any url
The default is "metacpan".
Pod::Markdown->new(perldoc_url_prefix => 'http://localhost/perl/pod');
• "perldoc_fragment_format"
Alters the format of the url fragment for any "L<>" links that point to a section of an external
document (""section" in name"). The default will be chosen according to the destination
"perldoc_url_prefix". Alternatively you can specify one of the following:
• "metacpan"
• "sco"
• "pod_simple_xhtml"
• "pod_simple_html"
• A code ref
The code ref can expect to receive two arguments: the parser object ($self) and the section text.
For convenience the topic variable ($_) is also set to the section text:
perldoc_fragment_format => sub { s/\W+/-/g; }
• "markdown_fragment_format"
Alters the format of the url fragment for any "L<>" links that point to an internal section of this
document ("section").
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.
Note: "markdown_fragment_format" and "perldoc_fragment_format" accept the same values: a (shortcut to
a) method name or a code ref.
• "include_meta_tags"
Specifies whether or not to print author/title meta tags at the top of the document. Default is
false.
• "escape_url"
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.
html_encode_chars
A string of characters to encode as html entities (using "encode_entities" in HTML::Entities if
available, falling back to numeric entities if not).
Possible values:
• A value of 1 will use the default set of characters from HTML::Entities (control chars, high-bit
chars, and "<&>"'").
• A false value will disable.
• Any other value is used as a string of characters (like a regular expression character class).
By default this is disabled and literal characters will be in the output stream. If you specify a
desired "output_encoding" any characters not valid for that encoding will be HTML entity encoded.
Note that Markdown requires ampersands ("&") and left angle brackets ("<") 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.
match_encoding
Boolean: If true, use the "=encoding" of the input pod as the encoding for the output.
If no encoding is specified, Pod::Simple will guess the encoding if it sees a high-bit character.
If no encoding is guessed (or the specified encoding is unusable), "output_encoding" will be used if it
was specified. Otherwise "UTF-8" will be used.
This attribute is not recommended but is provided for consistency with other pod converters.
Defaults to false.
output_encoding
The encoding to use when writing to the output file handle.
If neither this nor "match_encoding" are specified, a character string will be returned in whatever
Pod::Simple output method you specified.
local_module_re
Returns the regular expression used to determine local modules.
local_module_url_prefix
Returns the url prefix in use for local modules.
man_url_prefix
Returns the url prefix in use for man pages.
perldoc_url_prefix
Returns the url prefix in use (after resolving shortcuts to urls).
perldoc_fragment_format
Returns the coderef or format name used to format a url fragment to a section in an external document.
markdown_fragment_format
Returns the coderef or format name used to format a url fragment to an internal section in this document.
include_meta_tags
Returns the boolean value indicating whether or not meta tags will be printed.
escape_url
Returns the boolean value indicating whether or not URLs should be escaped.
format_man_url
Used internally to create a url (using "man_url_prefix") from a string like man(1).
format_perldoc_url
# With $name and section being the two parts of L<name/section>.
my $url = $parser->format_perldoc_url($name, $section);
Used internally to create a url from the name (of a module or script) and a possible section (heading).
The format of the url fragment (when pointing to a section in a document) varies depending on the
destination url so "perldoc_fragment_format" is used (which can be customized).
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 "markdown_fragment_format" is used (which can be
customized).
format_fragment_markdown
Format url fragment for an internal link by replacing non-word characters with dashes.
format_fragment_pod_simple_xhtml
Format url fragment like "idify" in Pod::Simple::XHTML.
format_fragment_pod_simple_html
Format url fragment like "section_name_tidy" in Pod::Simple::HTML.
format_fragment_metacpan
Format fragment for metacpan.org (uses "format_fragment_pod_simple_xhtml").
format_fragment_sco
Format fragment for search.cpan.org (uses "format_fragment_pod_simple_html").
is_local_module
Uses "local_module_re" to determine if passed module is a "local" module.