Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow newlines for role syntax parsing #269

Open
matthew-brett opened this issue Nov 11, 2020 · 4 comments
Open

Allow newlines for role syntax parsing #269

matthew-brett opened this issue Nov 11, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@matthew-brett
Copy link

I noticed that when my {download} inline markup flows across lines, the parsing fails. For example:

from myst_parser.main import to_html

markdown = """
{download}`Link text <test_long_link.py>`.

Here the link runs across lines, breaking parsing {download}`Here is a short
piece of link text <test_long_link.py>`.
"""

print(to_html(markdown))

generates

p><code class="sphinx-role">{download}[Link text &lt;test_long_link.py&gt;]</code>.</p>
<p>Here the link runs across lines, breaking parsing {download}<code>Here is a short piece of link text &lt;test_long_link.py&gt;</code>.</p>

Is this expected? It does not seem to be the case for Sphinx / ReST parsing.

@matthew-brett matthew-brett added the bug Something isn't working label Nov 11, 2020
@chrisjsewell
Copy link
Member

the way how roles are currently indentified in https://github.com/executablebooks/mdit-py-plugins/blob/5c0038fd4348cc37548b3ee7891a9f380517f959/mdit_py_plugins/myst_role/index.py#L8, it is expected.

but this could be relatively easily changed to allow for new line breaks

@chrisjsewell chrisjsewell added enhancement New feature or request and removed bug Something isn't working labels Jan 5, 2021
@chrisjsewell chrisjsewell changed the title Inline syntax breaks if it flows across lines. Allow newlines for role syntax parsing Jan 5, 2021
@choldgraf
Copy link
Member

In the meantime we should document that roles cannot span multiple lines as well (unless you think this enhancement will be done easily/quickly? wdyt?)

@matthew-brett
Copy link
Author

It's pretty easy to run over a line in a role, by accident, so my vote would be to change the behavior. Are there other Markdown inline markups that cannot run over lines?

@mmcky
Copy link
Member

mmcky commented Feb 16, 2021

we have come across this bug a couple times in some of our projects during migration checks. @AakashGfude perhaps we can see if this regex can be updated to accept newlines for roles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants