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

Doesn't work without empty line breaks #210

Open
Jinjiang opened this issue Feb 13, 2024 · 1 comment
Open

Doesn't work without empty line breaks #210

Jinjiang opened this issue Feb 13, 2024 · 1 comment

Comments

@Jinjiang
Copy link

input:

normal body

::: info first

first container body

:::

rest element

output:

<p>normal body</p>
<div class="remark-container info"><div class="remark-container__title">first</div><p>first container body</p></div>
<p>rest element</p>

input2:

normal body

::: info first
first container body
:::

rest element

output2 (wrong):

<p>normal body</p>

Thanks.

@koka831
Copy link
Owner

koka831 commented Feb 15, 2024

The behavior is as expected.
The reason we require a blank line is because the unist-util-visit used in this library interprets directives without blank lines in a certain way, which made parsing very difficult. Therefore, it is necessary to revise the parsing process so that it can handle cases without needing a blank line.


::: info
first child
<div>second child</div>
:::

will be converted in (with some simplify):

{ type: "paragraph", value: "::: info" }
{ type: "paragraph", value: "first child" }
{ type: "html": value: "<div>second child</div>:::" } ← this makes hard to parse

#120 (comment)

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

No branches or pull requests

2 participants