NAME
Pod::Simple::Role::XHTML::WithHighlightConfig - Allow configuring syntax highlighting hints in Pod
SYNOPSIS
# using in Pod
=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;
# using the role
package My::Pod::Simple::Subclass;
use Moo;
extends 'Pod::Simple::XHTML';
with 'Pod::Simple::XHTML::WithHighlightConfig';
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 adata-start
attribute on the<pre>
block. - highlight
-
A comma separated list of lines or line ranges to highlight, such as
5
,4-10
, or1,4-6,10-14
. It will be represented as adata-line
attribute on the<pre>
block.
SEE ALSO
- Modules Supporting the same configuration format
-
TOBYINK::Pod::HTML - Another Pod to HTML converter
App::sdview::Parser::Pod - A terminal documentation viewer
Pod::Markdown::Githubert - Pod to Markdown converter
- Users of HTML Attributes
-
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
SUPPORT
See MetaCPAN::Pod::HTML for support and contact information.
AUTHORS
See MetaCPAN::Pod::HTML for authors.
COPYRIGHT AND LICENSE
See MetaCPAN::Pod::HTML for the copyright and license.