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

Upgrade Marked (or switch to a different Markdown implementation) #272

Open
mootari opened this issue Dec 11, 2021 · 4 comments
Open

Upgrade Marked (or switch to a different Markdown implementation) #272

mootari opened this issue Dec 11, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@mootari
Copy link
Member

mootari commented Dec 11, 2021

Given the following Markdown containing a "loose list":

- a
- b
- c

- a
- b
- c

the generated HTML wraps multiple elements in paragraphs:

<ul>
<li>a</li>
<li>b</li>
<li><p>c</p>
</li>
<li><p>a</p>
</li>
<li>b</li>
<li>c</li>
</ul>

resulting in the following appearance:
image

Observable currently uses marked 0.3.12. This bug got fixed in marked 0.5.0 (demo, PR).

@mootari
Copy link
Member Author

mootari commented Dec 11, 2021

Aside: I originally intended to have two separate lists. In marked up until version 3.0.0 this can be achieved by separating the lists with two newlines.

From version 3.0.0 and onward marked follows commonmark, which requires a hack to separate the lists.

@mbostock mbostock added the enhancement New feature or request label Jun 7, 2022
@mbostock
Copy link
Member

mbostock commented Jun 7, 2022

We can’t upgrade Marked (used by our md tagged template literal and by extension Markdown cells) until we support standard library versioning. Otherwise we would almost certainly break countless notebooks. Once we have standard library versioning, new notebooks will get a new version of Marked, and old notebooks will be able to opt-in to upgrade.

@mbostock mbostock changed the title Marked: inconsistent list parsing Upgrade Marked Jun 7, 2022
@mbostock mbostock changed the title Upgrade Marked Upgrade Marked (or switch to a different Markdown implementation) Jun 7, 2022
@eagereyes
Copy link

I have a few more weird behaviors…

_Underscore italics_

_Underscore italics with `a_variable_name` embedded_

produces this HTML code (second line ignores the italics):

<p><em>Underscore italics</em></p>
<p>_Underscore italics with <code>a_variable_name</code> embedded_</p>

This works correctly when using asterisks instead of underscores.

This code

Here are escaped backticks \`md\`, and here they are un-escaped inside a code block: `md``` hello

But they work when there's a space: `md`` ` back to normal

produces this output (backticks are sometimes ignored):

<p>Here are escaped backticks `md`, and here they are un-escaped inside a code block: `md``` hello</p>\n<p>But they work when there's a space: <code>md``</code> back to normal</p>

The backtick issues are fixed in the current version, but the underscore confusion seems to persist (but looks a little different). See this test in the Marked playground.

Here's a little notebook with the examples

@GordonSmith
Copy link

Another one, which is resolved in newer version of marked:

- [ ] foo
- [X] fooxx

Should be:

  • foo
  • fooxx

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