Serum
Serum copied to clipboard
v1: update earmark to fix parsing of markdown + html
i have a Markdown document https://codeberg.org/meena-co/website/src/branch/main/thoughts/2015-12-03-software-vs-automation.md that's intersperse with HTML (a tweet)
This is parsed as so:
https://igalic.co/thoughts/2015-12-03-software-vs-automation.html
it seems that this is somewhat fixed in newer versions of earmark: https://github.com/pragdave/earmark/issues/357 but i might be reading this wrong.
The funny thing is that https://codeberg.org/meena-co/website/src/branch/main/thoughts/2017-09-06-ops2dev.md this is parsed correctly: https://igalic.co/thoughts/2017-09-06-ops2dev.html
Could you please explain the difference between what you expected and what you actually got? I'm barely able to tell the difference between two examples you have provided. (All I could notice was whether the trailing <script>
tag is nested into a <p>
tag or not.)
Am I missing something obvious? Or maybe your HTML formatter script has "fixed" all invalid HTML markups...?
Although many Elixir projects, including Serum, depend on Earmark for parsing Markdown documents, Earmark has been exhibiting unreliable behaviors for a quite long time when parsing multi-line code blocks and HTML markups. And almost every time I updated Earmark, I stepped upon some unexpected quirks which may break other users' pages and blog posts. So honestly, at some moment I gave up updating Earmark, despite any benefits of keeping dependencies up to date.
Therefore it will take some (probably long) time to extensively test Earmark, before I decide whether to update its version or not.
weird. of course now that you look at it, it magically works.
i have no idea what could've changed, the only changes i made were to the layout and the CSS, and those shouldn't affect a completely broken markdown rendering:
for that reason i removed the post from public view (draft: true
)
I am using :phoenix_markdown in one of my umbrella applications and :serum in another. I have :earmark_parser 1.4.18 as a dependency for the former, and :earmark 1.4.4 for the latter. Now I have this when I build a release:
** (Mix) Duplicated modules:
string_lexer specified in earmark and earmark_parser
link_text_parser specified in earmark and earmark_parser
link_text_lexer specified in earmark and earmark_parser
I don't know if this would be fixed if serum were to use a newer version of earmark. I was dismayed to find out that the earmark 1.4.19 release was broken, and had to specify my dependencies to use 1.4.18.
I just upgraded earmark to v1.4.24, which is currently the latest version available.
Some tests were broken, Some pages and blog posts of my website were broken, And it's highly likely that this update will break some of yours too.
If you are still using Serum, please try this new update by pointing the :serum
deps to this GitHub repository:
# In your mix.exs:
defp deps do
[
{:serum, github: "Dalgona/Serum", ref: "3d85b00b40215e9d7cc351c6a1c9756710150e92"}
# ...
]
end
Build your project, thoroughly inspect any pages generated from markdown files, and please share any issues in this thread. If you managed to fix any weird renderings, it would be grateful if you also share your workarounds.
yes, works