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
Replace hoedown markdown parser with CMark #714
Conversation
Do like zlib/quazip/ghc-filesystem etc and check if it's installed in the system, dynamically link if found and if it isn't found or Launcher_FORCE_BUNDLED_LIBS is on statically link |
Since modrinth uses GitHub flavoured markdown, might make more sense to use cmark-gfm (GitHub's cmark fork) instead |
Forgor to say it but cmark-gfm is also commonly packaged (see https://repology.org/project/cmark-gfm/versions ), so yeah do what I said there ^ |
We probably need this at the very least for our MSVC Windows builds. I have pushed a commit adding support for system installs of CMark as well as falling back to a submodule, if required. I have also looked at cmark-gfm, but it looks like it doesn't provide CMake files to allow finding it using |
Erk, that's annoying :-) But if we want to switch to GFM for whatever reason - it shouldn't change anything API wise so that's something we can put off doing until later. It's not like I encountered anything in the changelogs or mod pages I've viewed that requires GH extensions |
I guess not having gfm extensions is not a big issue for now, but flatpak build for some reason is failing |
The fix should be simple, I just need to add cmark to the flatpak manifest. I'll be adding a commit to fix that :-) |
Also, is there a standard format for writing new license headers? I see a mix of some of the old license headers from the MultiMC/PolyMC days but also SPDX. I'm guessing I should mark it GPLv3 with SPDX. |
I also tested every place I could (with the exception of the updater, I don't know how to test that easily). The commits are all signed, messages fixed up and ready for review now :-) |
just found a mod using gfm stuff https://modrinth.com/mod/immediatelyfast uses tables |
just found a mod using gfm stuff
Erk :-) I'll look into changing it to the GFM fork then
|
I got around to working on this again, but looking through cmark gfm is nothing but pain. Not only are they a fork of cmark - that part is fine - but they don't include important commits like github/cmark-gfm@c8d5be9 which fixes CMake Also the availability of cmark-gfm pales in comparison to regular cmark. Not that this is a problem if we include it as a submodule, this only matters for linux packaging. And to include the relevant GitHub extensions (notably tables) I would have to expand the Okay, so let's just accept all of those problems and just take the plunge:
No way, it includes a private header in a public API, so even if I wanted to include cmark-gfm support I couldn't :-( Oh there's an open PR for that but it hasn't been merged yet. Since there's been no activity, Nix and Ghostwriter had to implement workarounds for this bug, Nix PR here and ghostwriter commit here respectively. Is there that many mods that use tables in their READMEs? It's a shame that they don't render, but honestly cmark-gfm is a baffling library. We could vendor cmark-gfm and then apply our own patches, but I think that's a bad idea for a lot of reasons (and ideally, this would be fixed upstream). I think this PR is in a good state right now and we can look at cmark-gfm support later, because with just plain cmark our markdown is much better than before :-) Perfection cannot be the enemy of good, etc |
Yeah let's just use normal cmark then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks!
When you rebase develop with signoff: |
Oops, somehow a bunch of unrelated commits made it's way into here :S |
Signed-off-by: Joshua Goins <josh@redstrate.com>
Signed-off-by: Joshua Goins <josh@redstrate.com>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Joshua Goins <josh@redstrate.com>
Signed-off-by: Joshua Goins <josh@redstrate.com>
this way we can just dynamically link it on that build instead of building it ourselves and statically linking it Signed-off-by: DioEgizio <83089242+DioEgizio@users.noreply.github.com>
This is a draft for patches to replace the old, crusty and buggy hoedown markdown library - with CMark.
Benefits
hoedown.h
needed to wrap api calls)CMark also supports raw HTML blocks, so stuff like mod pages are no longer broken and have to be worked around (#713):
Since we don't need a resource wrapper, and less quirks because hoedown is terrible - it also means less lines of code worrying about markdown rendering :-)
Tasks
Questions
It's a small library anyway, so it doesn't matter either way.
markdownToHTML
function? I haven't touched the codebase in a while, so I'm not sure if you want anything more than a static global function.