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

Better support for (GitHub flavored) Markdown #1320

Closed
lschierer opened this issue Nov 14, 2024 · 6 comments · Fixed by #1371
Closed

Better support for (GitHub flavored) Markdown #1320

lschierer opened this issue Nov 14, 2024 · 6 comments · Fixed by #1371
Assignees
Labels
alpha.3 breaking bug Something isn't working CLI enhancement Improve something existing (e.g. no docs, new APIs, etc) question Further information is requested v0.31.0
Milestone

Comments

@lschierer
Copy link
Contributor

lschierer commented Nov 14, 2024

Type of Change

Other

Summary

Running list of issues hit with remark Markdown support:

  1. If you enable the remark-gfm plugin via the remark option in the greenwood.config.js, it mostly works, but footnotes do not work.
  2. Markdown inside definition lists is not rendered.

Details

  1. remark-gfm is one of the few ways that I can find in the unifiedjs ecosystem for handling footnotes in markdown. The alternative, remark-footnote, has a note on it saying that it is deprecated and to use remark-gfm. I'm still exploring alternatives, but better support for this fairly standard remark plugin would be great.
  2. Markdown does many things well, but occasionally there are things it can't. I ended up using a definition list to manage content in some of my pages and found that markdown inside both the title and definition sections is not rendered. You can see a minimal reproduction of this at https://github.com/lschierer/greenwood-repoductions/tree/definitionlist (note that is a branch of the repository) on the http://localhost:1984/definitionlistpage/ page if run in dev mode.
@thescientist13 thescientist13 added the question Further information is requested label Nov 15, 2024
@thescientist13
Copy link
Member

thescientist13 commented Nov 15, 2024

Thanks for the report, I had tried playing around with this myself during our chat but didn't see anything obvious as to why just that specific feature wouldn't work, but could be attributed to maybe some of our unified and related deps being out of date?

Let me explore this as part of #1247 and see if anything materializes after doing a bunch of version bumps.

@thescientist13 thescientist13 added this to the 1.0 milestone Nov 15, 2024
@thescientist13 thescientist13 added CLI bug Something isn't working labels Nov 15, 2024
@lschierer lschierer changed the title Better support for the remark-gfm plugin Better support for Markdown Nov 21, 2024
@lschierer
Copy link
Contributor Author

Screenshot 2024-11-21 at 14 12 41

screenshot of the poor handling of definition lists.

@lschierer
Copy link
Contributor Author

Screenshot 2024-11-21 at 14 18 37

from my actual project, you can see it breaks down rather more severely.

@lschierer
Copy link
Contributor Author

Screenshot 2024-11-21 at 14 20 10

an example of the footnotes failing.

@thescientist13
Copy link
Member

thescientist13 commented Dec 6, 2024

Thanks for sharing these examples and screenshots, will be able to start looking into this shortly (almost wrapped up with the PNPM compat effort and so planning on looking into this more thoroughly right after that)

@thescientist13
Copy link
Member

Just wanted to give an update here, as I've put up a PR for this - #1371 with demo content you can see in the www/ directory.
https://github.com/ProjectEvergreen/greenwood/pull/1371/files#diff-11b99ea2d3f7b00b6af52fda7ed33aace0be0ee1ffffbd3edcce374fcba1fb59

GFM

Can confirm this is all working now and outputting the expected HTML using the same snippet from the remark-gfm README 🎉

Screenshot 2024-12-30 at 1 48 26 PM

Definitions List

So this issue seems more related to the formatting of the markdown / HTML I saw in your repo, rather than anything to do with markdown rendering. From my experience, indentation matters, as can be observed by looking at the markdown contents in an IDE like VSCode.

For example, looking at the file in an IDE witho and without indentation, we can see syntax highlight lighting up in the formatted version

Screenshot 2024-12-30 at 2 38 33 PM
Screenshot 2024-12-30 at 2 38 57 PM

And that when the indention is aligned, the markdown renders correctly to the expected HTML output
Screenshot 2024-12-30 at 2 57 23 PM

This is further validated by noticing that markdown you have nested inside HTML is not formatting correctly, even when the <dl> tags are indented consistently, as nested markdown formatting inside HTML blocks will just get processed as HTML per the spec, so pretty much I think this is all working as expected.

An HTML block is a group of lines that is treated as raw HTML (and will not be escaped in HTML output).


Have queued this up for the next alpha release so hopefully this should get Greenwood's markdown support updated to all the latest and greatest in the unified / remark / rehype ecosystem. 💯

@thescientist13 thescientist13 moved this from 🏗 In progress to 👀 In review in [Greenwood] Phase 10 - Ecosystem Compat Dec 31, 2024
@thescientist13 thescientist13 changed the title Better support for Markdown Better support for (GitHub flavored) Markdown Jan 9, 2025
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in [Greenwood] Phase 10 - Ecosystem Compat Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpha.3 breaking bug Something isn't working CLI enhancement Improve something existing (e.g. no docs, new APIs, etc) question Further information is requested v0.31.0
Projects
2 participants