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

fix: parse markdown buffer with markdown parser and get inlines as children #58

Merged
merged 3 commits into from
Oct 22, 2023

Conversation

jmbuhr
Copy link
Contributor

@jmbuhr jmbuhr commented Oct 22, 2023

This fixes interactions with other plugins by not accidentally attaching a wrong parser to markdown buffers (that would get re-used by other plugins when they require the parser).

It should also safeguard against future bugs, because previously we would attach the "markdown_inline" parser directly to the buffer, which would also try to parse all the parts that are not plain markdown (like yaml headers, html and code chunks) as inline markdown.

This does change the behavior slightly, but I'd say makes it more expected. Previously, because the whole buffer would be treated as if it where only "markdown_inline", it would also detect images with the markdown syntax in parts that are not markdown, so this is no longer happening. e.g. if you had a code chunk with a comment that contained some markdown image syntax.

# Hello world

```{python}
# this is a comment with ![](./some/image.png)
# this will, rightfully, not be rendered anymore
print('hello world')
```

But this will: ![](./some/image.png)

@jmbuhr jmbuhr changed the title fix: parse markdown buffer with markdown parser and get inlines as children [draft] fix: parse markdown buffer with markdown parser and get inlines as children Oct 22, 2023
@3rd 3rd merged commit 0129ddc into 3rd:master Oct 22, 2023
1 check passed
@3rd
Copy link
Owner

3rd commented Oct 22, 2023

Amazing work, thank you so much!

This pull request was closed.
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

Successfully merging this pull request may close these issues.

2 participants