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

v1: update earmark to fix parsing of markdown + html #175

Closed
igalic opened this issue Mar 29, 2021 · 5 comments
Closed

v1: update earmark to fix parsing of markdown + html #175

igalic opened this issue Mar 29, 2021 · 5 comments
Labels
area:dependencies needs more info v1 Maintenance tasks for Serum v1.x
Milestone

Comments

@igalic
Copy link
Contributor

igalic commented Mar 29, 2021

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: pragdave/earmark#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

@Dalgona Dalgona added the v1 Maintenance tasks for Serum v1.x label Apr 2, 2021
@Dalgona
Copy link
Owner

Dalgona commented Apr 2, 2021

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.

@igalic
Copy link
Contributor Author

igalic commented Apr 2, 2021

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:

raw markdown printed on website instead of rendered HTML

for that reason i removed the post from public view (draft: true)

@pzingg
Copy link

pzingg commented Mar 1, 2022

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.

@Dalgona
Copy link
Owner

Dalgona commented Apr 2, 2022

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.

@Dalgona Dalgona pinned this issue Apr 2, 2022
@Dalgona Dalgona added this to the v1.6.0 milestone Apr 2, 2022
@igalic
Copy link
Contributor Author

igalic commented Apr 8, 2022

yes, works

@Dalgona Dalgona closed this as completed Sep 4, 2022
@Dalgona Dalgona unpinned this issue Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dependencies needs more info v1 Maintenance tasks for Serum v1.x
Projects
None yet
Development

No branches or pull requests

3 participants