The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Markdown::Parser::NewLine - Markdown New Line Element

SYNOPSIS

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

VERSION

    v0.2.1

DESCRIPTION

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

METHODS

as_markdown

Returns a string representation of the new line formatted in markdown.

It returns a plain string.

as_pod

Returns a string representation of the new line formatted in pod.

It returns a plain string.

as_string

Returns an html representation of the new line.

It returns a plain string.

break

Boolean value to set whether this new line is a line break implying a <br /> html tag.

According to Markdown original author, John Gruber, this is the case when one creates 2 or more spaces followed by a new line in Markdown. For example:

    This is an example of a line break  
    and this line will be in another line.

This will be rendered as:

    This is an example of a line break<br />
    and this line will be in another line.

Without the 2 space preceding the line break, the html representation would have put this on one line like so:

    This is an example of a line break and this line will be in another line.

new_line

This sets or gets the character representation of a new line. Typically this would be \n

This stores the value as a Module::Generic::Scalar

repeating

Provided with an integer to set the number of time the new line was repeated, implying there was other new lines before. The parser uses it as an indicator during parsing, so this is more of an internal use and can be safely ignored.

Note that this method can be accessed as a regular object method, and also as an lvalue method, such as :

    $nl->repeating( 2 );
    # or
    $nl->repeating = 2;

SEE ALSO

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

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.