NAME

Pod::Simple::XHTML::WithHighlightConfig - Allow configuring syntax highlighting hints in Pod

SYNOPSIS

  =head1 SYNOPSIS

  =for highlighter language=javascript

    var date = new Date();

  =for highlighter language=perl line_numbers=1 start_line=5

    my @array = map { $_ + 1 } (5..10);

  =for highlighter

    No language set

  =for highlighter perl

    use Class;
    my $var = Class->new;

DESCRIPTION

This module allows adding syntax highlighter hints to a Pod document to be rendered as XHTML. Normally, verbatim blocks will be represented inside <pre><code>...</code></pre> tags. The information will be represented as class names and data attributes on those tags.

Configuration values effect all verbatim blocks until the next highlighter configuration directive.

CONFIGURATION

The configuration must be specified in a =for highlighter block, as a whitespace separated list of settings. Each setting must be in the form <key>=<value>. Alternately, a bare option without an = can be used to specify the language setting.

language

This is the language to highlight the verbatim blocks with. It will be represented as a language-$language class on the <code> tag.

line_numbers

A true or false value indicating if line numbers should be included. If true, it will be represented as a line-numbers class on the <pre> block.

start_line

A number for what to start numbering lines as rather than starting at 1. Only valid when the line_numbers option is enabled. It will be represented as a data-start attribute on the <pre> block.

highlight

A comma separated list of lines or line ranges to highlight, such as 5, 4-10, or 1,4-6,10-14. It will be represented as a data-line attribute on the <pre> block.

SEE ALSO

  • TOBYINK::Pod::HTML - Another module using the same configuration format

  • HTML5 code element - Semantics for highlighting encouraged by the HTML5 spec

  • Prism - A javascript syntax highlighter supporting the classes and attributes used by this module

AUTHOR

haarg - Graham Knop (cpan:HAARG) <haarg@haarg.org>

CONTRIBUTORS

None so far.

COPYRIGHT

Copyright (c) 2014 the Pod::Simple::XHTML::WithHighlightConfig "AUTHOR" and "CONTRIBUTORS" as listed above.

LICENSE

This library is free software and may be distributed under the same terms as perl itself.