Closed nojaf closed 2 months ago
Hi @nojaf, thank you for opening the issue, upon initial inspection I can notice that this issue is related to the npm packages that this component uses for parsing/stripping Markdown/JSX, i.e.: mdast-util-from-markdown
, mdast-util-mdx
and micromark-extension-mdxjs
.
Currently, it is not supported to skip parsing of HTML because it's necessary for plain text extraction but I will do my best to find a solution to this tomorrow, will keep you updated!
Edit: also, is this, nojaf/blog the repository that I can test against?
Hi @igorskyflyer , thanks for the swift reply! Yes, you can use nojaf/blog, do note that I haven't pushed the updated package.json anywhere. Thanks a bunch for your time.
Hi @igorskyflyer , thanks for the swift reply! Yes, you can use nojaf/blog, do note that I haven't pushed the updated package.json anywhere. Thanks a bunch for your time.
Indeed, I'll upgrade from v2.1.0
to the latest version (thanks for mentioning it) then do some tests and get back to you.
Hey @nojaf, since no proper stack trace is shown when the exception occurs, I had to go the old-fashioned way 😎, I managed to hunt down the exception, it is thrown by the mdast-util-mdx-jsx
(as assumed).
But that's only one piece of the puzzle 🧩. I'll try and think of a solution tonight.
@nojaf, just found a workaround for your issue until this issue is resolved permanently.
While investigating and testing further, I have noticed that mdast-util-mdx-jsx
actually works quite well but there are some edge cases, like yours.
In one of your Markdown files the issue is caused by this HTML block - the one you mentioned (formatted for readability):
"/src/content/blog/fantomas-configuration-file/index.md"
<blockquote class="twitter-tweet">
<p lang="en" dir="ltr">New version of <a href="https://twitter.com/IonideProject?ref_src=twsrc%5Etfw">@IonideProject</a> is out - it updates Fantomas support to the latest version including support for Fantomas configuration file (<a href="https://t.co/Pw3TqQ4kYe">https://t.co/Pw3TqQ4kYe</a>)<br><br>Props to <a href="https://twitter.com/verdonckflorian?ref_src=twsrc%5Etfw">@verdonckflorian</a> and <a href="https://twitter.com/ChetHusk?ref_src=twsrc%5Etfw">@ChetHusk</a> for working on this. <a href="https://twitter.com/hashtag/fsharp?src=hash&ref_src=twsrc%5Etfw">#fsharp</a> <a href="https://twitter.com/hashtag/toolingAdventures?src=hash&ref_src=twsrc%5Etfw">#toolingAdventures</a></p>— Krzysztof Cieślak (@k_cieslak) <a href="https://twitter.com/k_cieslak/status/1215239179472375808?ref_src=twsrc%5Etfw">January 9, 2020</a>
</blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
It seems the mentioned library used for parsing and stripping of Markdown and JSX doesn't allow a <br>
inside of a paragraph and <br>
s that are not closed.
The code works after:
<p>
tag with the <div>
tag,<br>
elements inside the <div>
, i.e.:
"/src/content/blog/fantomas-configuration-file/index.md"
<blockquote class="twitter-tweet">
<div lang="en" dir="ltr">New version of <a href="https://twitter.com/IonideProject?ref_src=twsrc%5Etfw">@IonideProject</a> is out - it updates Fantomas support to the latest version including support for Fantomas configuration file (<a href="https://t.co/Pw3TqQ4kYe">https://t.co/Pw3TqQ4kYe</a>)<br /><br />Props to <a href="https://twitter.com/verdonckflorian?ref_src=twsrc%5Etfw">@verdonckflorian</a> and <a href="https://twitter.com/ChetHusk?ref_src=twsrc%5Etfw">@ChetHusk</a> for working on this. <a href="https://twitter.com/hashtag/fsharp?src=hash&ref_src=twsrc%5Etfw">#fsharp</a> <a href="https://twitter.com/hashtag/toolingAdventures?src=hash&ref_src=twsrc%5Etfw">#toolingAdventures</a></div>— Krzysztof Cieślak (@k_cieslak) <a href="https://twitter.com/k_cieslak/status/1215239179472375808?ref_src=twsrc%5Etfw">January 9, 2020</a>
</blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
NOTE
Besides this file, all Markdown files work as expected, except
"/src/content/blog/vscode-extension-with-fable/index.md"
, that one causes another parsing issue, around the code block at line 312 and other code blocks beyond it. Notice that you don't have those code block properly formatted for Markdown, they are rendered as plain text. 😞
Hi @igorskyflyer! Thanks a bunch for this deep dive analysis!
I updated the blockquote
and made proper code blocks in the other post and it now all works!
Feel free to close this issue is nothing actionable is left.
@nojaf, I am glad we made it work! 🎉🍾
If there are any issue(s) in the future, don't hesitate to open new issues here. 🙏🏻
P.S. thanks for the tip! 🙂
Hi,
I just updates to
3.0.4
and I'm seeingfor
rendered by
My markdown does contain the following HTML:
which probably is the culprit. Updating
<br><br>
to<br/><br/>
does not solve the problem. Can I somehow skip this HTML part from thePostExcerpt
?