-
Notifications
You must be signed in to change notification settings - Fork 30
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
Markdownz: replace remark with markdownz #5352
Conversation
30de769
to
fb83f3c
Compare
expect(container.querySelectorAll('a[href]')).to.have.lengthOf(12) | ||
expect(container.querySelectorAll('p')).to.have.lengthOf(17) | ||
expect(container.querySelectorAll('a[href]')).to.have.lengthOf(10) | ||
expect(container.querySelectorAll('p')).to.have.lengthOf(18) |
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.
These changes get the tests passing, but I can't figure out, from the example markdown, what the expected values really should be.
dad57d4
to
9f05e22
Compare
9f05e22
to
89905b6
Compare
Had to install Rehype 11, because Rehype 12+ is only available as ESM. |
aa48a48
to
db5b846
Compare
Rehype parses a HTML fragment as a full page, wrapped in Fixed by explicitly setting |
1fabec3
to
412cf85
Compare
|
50dd682
to
38f033f
Compare
Re: Rehype 12+ is only available as ES - I didn't realize that we'd run into the same headache of ESM-only package by switching to rehype so thank you for noting that right away! I think I'm hesitant about replacing remark with rehype because it seems like a temporary solution and also hesitant that markdown-it hasn't been updated recently (as you noted). What are your thoughts on FEM markdown strategy going forward? What's your opinion on switching to |
38f033f
to
c5f9f8b
Compare
Depends on what stakeholders, which would be project teams here, expect from Zooniverse-flavoured markdown. If they expect their markdown to continue to work without changes, then With Remark, the input markdown changes and the output HTML is different, which should be summarised in ADR 11. So project teams will have to edit their existing markdown for the new parser, and we will need to document the required changes for them. We also need to install or write Remark plugins to handle custom features of Zooniverse-flavoured markdown, including:
My personal preference would be to leave Zooniverse-flavoured markdown unchanged if possible, so use NB. Remark uses Rehype to convert its output HTML to a React component tree, and Re. ESM: that's a wider issue that affects all our dependencies. This monorepo was built on CommonJS, at a time when CommonJS was being replaced by ES modules but
The config files and custom Express servers for both NextJS apps are also written in CommonJS. We need to be able to build and test in a world where not all of our dependencies are CommonJS any more. Whichever markdown parser we choose to use, it's not likely to be available as a CommonJS module forever. I've made Bun has a good summary of the current state of Node module resolution. |
c5f9f8b
to
4ec8ccf
Compare
The new pulsars project uses a YouTube video: I've added it to the list of examples at the top of this PR. |
f740e04
to
4a4b82b
Compare
The links to example projects are helpful - thank you! Because of the change to external links (requiring Let's notify the #project-building channel after this gets merged tomorrow about changes to markdown behavior going live on next FEM deploy (November 7). That'll give PMs a week or so to communicate to project teams. |
Replace `remark` with `markdownz`, to parse Zooniverse markdown to HTML, and `rehype`, to render the parsed HTML as a React component tree. Bump `@zooniverse/react-components` to 1.8.0. Our `markdown-it` plugins rely on Node modules. I've added fallbacks to the dev classifier and project Webpack builds, where they require them.
8.5.0 introduces a `useMarkdownz` hook.
`markdownz` 9.0.0 includes `rehype`, so we can remove it here.
Inject parsed markdown with the `useMarkdownz` hook.
4a4b82b
to
a0b2cbe
Compare
Replace
remark
withmarkdownz
, to parse Zooniverse markdown to HTML, andrehype
, to render the parsed HTML as a React component tree.Bump
@zooniverse/react-components
to 1.8.0.Our
markdown-it
plugins rely on Node modules. I've added fallbacks to the dev classifier and project Webpack builds, where they require them.Rehype 12+ is only available as ESM, so I've installed Rehype v11.Rehype is bundled withmarkdownz
.includes Display Media images inline #5341.Package
How to Review
I've updated the Markdownz Grid Example story to add various examples of Zooniverse-flavoured markdown.
http://localhost:6007/?path=/story/components-markdownz--grid-example
I've also deployed this to kubernetes, so that we can check various production projects:
Checklist
PR Creator - Please cater the checklist to fit the review needed for your code changes.
PR Reviewer - Use the checklist during your review. Each point should be checkmarked or discussed before PR approval.
General
yarn panic && yarn bootstrap
ordocker-compose up --build
and FEM works as expectedGeneral UX
Example Staging Project: i-fancy-cats
Refactoring