NAME

Markdown::Parser::Footnote - Markdown Footnote Element

SYNOPSIS

my $o = Markdown::Parser::Footnote->new;
# or
$doc->add_element( $o->create_footnote( @_ ) );

VERSION

v0.2.0

DESCRIPTION

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

This is an extension of the original Markdown.

To quote from Markdown Guide:

Footnotes allow you to add notes and references without cluttering the body of the document. When you create a footnote, a superscript number with a link appears where you added the footnote reference. Readers can click the link to jump to the content of the footnote at the bottom of the page.

To create a footnote reference, add a caret and an identifier inside brackets ([^1]). Identifiers can be numbers or words, but they can’t contain spaces or tabs. Identifiers only correlate the footnote reference with the footnote itself — in the output, footnotes are numbered sequentially.

Add the footnote using another caret and number inside brackets with a colon and text ([^1]: My footnote.). You don’t have to put footnotes at the end of the document. You can put them anywhere except inside other elements like lists, block quotes, and tables.

Here's a simple footnote,[^1] and here's a longer one.[^bignote]

[^1]: This is the first footnote.

[^bignote]: Here's one with multiple paragraphs and code.

    Indent paragraphs to include them in the footnote.

    `{ my code }`

    Add as many paragraphs as you like.

The rendered output looks like this:

Here’s a simple footnote,1 and here’s a longer one.2

    1. This is the first footnote. ↩

    2. Here’s one with multiple paragraphs and code.

       Indent paragraphs to include them in the footnote.

       { my code }

       Add as many paragraphs as you like. ↩

Inline Footnotes

For consistency with links, footnotes can be added inline, like this:

I met Jack [^jack](Co-founder of Angels, Inc) at the meet-up.

Inline notes will work even without the identifier. For example:

I met Jack [^](Co-founder of Angels, Inc) at the meet-up.

However, in compliance with pandoc footnotes style, inline footnotes can also be added like this:

Here is an inline note.^[Inlines notes are easier to write, since
you don't have to pick an identifier and move down to type the
note.]

The footnote id of inline notes will be auto-generated

Footnotes will appear at the end of the document in their order of appearance.

METHODS

as_markdown

Returns a string representation of the footnote formatted in markdown.

It returns a plain string.

as_pod

Returns a string representation of the footnote formatted in pod.

It returns a plain string.

as_string

Returns an html representation of the footnote.

It returns a plain string.

footnote

Set or gets the Markdown::Parser::Footnote object, i.e. the footnote that is reference by this object.

id

Sets or gets the id of the backlink, i.e. the link reference back to the location that reference this footnote.

This is used to create a link back to the original footnote reference.

Sets or gets the id of the footnote. The value is stored as an Module::Generic::Scalar object.

Here's a simple footnote,[^1] and here's a longer one.[^bignote]

This will produce:

Here's a simple footnote,1 and here's a longer one.2

1 and 2 will be displayed in superscript.

"footnote_ref_sequence" in Markdown::Parser keeps track of the sequence and allocates it to each new footnote reference found.

sequence

This incremental number set for each occurence of a footnote reference.

SEE ALSO

https://www.markdownguide.org/extended-syntax#footnotes, https://pandoc.org/MANUAL.html#footnotes

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.