The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Markdown::Parser::Document - Markdown Document Element

SYNOPSIS

    my $doc = Markdown::Parser::Document->new;
    # or
    my $parser = Markdown::Parser->new;
    my $doc = $parser->create_document;

VERSION

    v0.2.0

DESCRIPTION

This class represents a markdown document. It is used by Markdown::Parser and inherits from Markdown::Parser::Element

This is the top element used and created by the parser.

METHODS

abbreviation_case_sensitive

Boolean that affects how "get_abbreviation" works. If set to true, then abbreviations will be case sensitives, otherwise case will not matter. Default is to be case insensitive.

Provided with an css stylesheet URI, and this will add it to the document.

It returns an error if the url is not a valid url.

If the url has already been set, it will be ignored, so as to avoid duplicates.

It returns the current document object for chaining.

add_js_data

Provided with some javascript code, and this will add it to the stack stored in "js_data".

If it was already provided, it will be ignore so as to avoid duplicates.

It returns the current document object for chaining.

Provided with an javascript URI, and this will add it to the document.

It returns an error if the url is not a valid url.

If the url has already been set, it will be ignored, so as to avoid duplicates.

It returns the current document object for chaining.

add_object

Provided with a Markdown::Parser::Element object and this will add it to its list of objects for this document in the special hash "objects" using the object id retrieved with "object_id" in Markdown::Parser::Element

as_markdown

Returns the document as markdown

as_pod

Returns the document as pod

as_string

Returns the parsed document structure as html, possibly including inline css rules

bolds

Sets or gets an hash reference of bolds values.

css

A shared CSS::Object object, instantiated by Markdown::Parser and shared with modules that may require the use of css, such as Markdown::Parser::Table

This method is called by as_string to add the necessary inline css rules in the head fo the resulting html document.

Sets or gets an array reference of css links.

It returns a Module::Generic::Array objects.

default_email

Sets or gets the default email address to use for email obfuscation.

It could be something that should not exist like dave.null@example.com

dict

An alias for "dictionary"

dictionary

This is a Module::Generic::Hash object containing key-value pairs for term definition.

email_obfuscate_class

The css class to use when obfuscating email address.

See "as_string" in Markdown::Parser::Link

email_obfuscate_data_host

The fake host to use when performing email obfuscation.

See "as_string" in Markdown::Parser::Link

email_obfuscate_data_user

The fake user to use when performing email obfuscation.

See "as_string" in Markdown::Parser::Link

emphasis

Sets or gets an hash reference of key-value paris used for emphasis.

This returns a Module::Generic::Hash object.

footnotes

Sets or gets an array reference of footnotes.

This returns a Module::Generic::Array object.

footnotes_dict

Sets or gets a dictionary hash of footnotes to their definition.

This returns a Module::Generic::Hash object.

get_abbreviation

Given a term, this will return its corresponding Markdown::Parser::Abbr object

If "abbreviation_case_sensitive" is set to a true value, the terms will be case sensitive.

get_footnote

Provided a footnote reference like 1 or thisRef and this will return the corresponding Markdown::Parser::Footnote object, if any.

Provided a link id, and this returns the corresponding Markdown::Parser::Link object, if any.

is_email_obfuscation_setup

Sets or gets a boolean value whether the email obfuscation is enabled.

is_katex_setup

Sets or gets a boolean value whether katex is enabled.

See the Katex website for more information

is_mermaid_setup

Sets or gets a boolean value whether mermaid is enabled.

Mermaid is a nifty tool used for generating flowchart effortlessly.

See the Mermaid website for more information

js_data

Sets or gets the array reference object of javascript code to be used in this document.

This returns a Module::Generic::Array object.

Sets or gets the array reference object of javascript links to be used in this document.

This returns a Module::Generic::Array object.

katex_delimiter

Sets or gets the array reference object of possible katex delimiters.

This defaults to:

    ['$$','$$','$','$','\[','\]','\(','\)']

This returns a Module::Generic::Array object.

Sets or gets the hash object containing link name and definition pairs.

The hash object is a Module::Generic::Hash object.

objects

Sets or gets the hash object of Markdown::Parser::Elements ids to their corresponding object.

This is a repository used internally and not to be messed up with.

It returns a Module::Generic::Hash

register_abbreviation

Provided an Markdown::Parser::Abbr object, and this add the abbreviation to the list of known abbreviations.

register_footnote

Provided an Markdown::Parser::Footnote object, and this add the footnote with its id to the list of known footnotes.

Provided with a a Markdown::Parser::LinkDefinition object, and this adds it to the hash object for future reference.

Returns the current document object.

setup_email_obfuscation

If "is_email_obfuscation_setup" is enabled and based on the "email_obfuscate_class" class defined, and this will use CSS::Object to find all matches and implement obfuscation for each match found.

This is based on a novel idea from https://stackoverflow.com/a/21421949/4814971

It returns the current document object for chaining.

setup_katex

If "is_katex_setup" is enabled, this will add all the necessary css and javascript resource to transform markdown mathematic typesettings into visual ones .

It returns the current document object for chaining.

setup_mermaid

If "is_mermaid_setup" is enabled, this will add all the necessary css and javascript resource to transform markdown flowcharts into visual flowcharts.

It returns the current document object for chaining.

SEE ALSO

Markdown original author reference on emphasis: https://daringfireball.net/projects/markdown/syntax#link

AUTHOR

Jacques Deguest <jack@deguest.jp>

COPYRIGHT & LICENSE

Copyright (c) 2020 DEGUEST Pte. Ltd.

You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.