Skip to content

Embedded URIs with newlines result in incorrect anchors #44

@terrencegf

Description

@terrencegf

Embedded URIs should allow for newlines as shown in an example at http://docutils.sourceforge.net/docs/user/rst/quickref.html#hyperlink-targets . The current parsing of links assumes the link is contained on a single line, which can result in empty anchor links. Examples:

Correct when all on one line:

INPUT 
`Google <https://google.com>`_

OUTPUT
<p><a href="https://google.com">Google</a></p>

Incorrect when spanning two lines:

INPUT 
`Google
<https://google.com>`_

OUTPUT
<p><a href="">Google
&lt;https://google.com&gt;</a></p>

Note that the Online reStructuredText Editor (http://rst.ninjs.org) correctly renders the link in both cases.

I think the fix requires Parser.php to have a new 'state' when parsing links to allow for links that span multiple lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions