Upgrade to latest remark 13 #30385
Replies: 7 comments 8 replies
-
Tried them out on my blog with no apparent problems! KyleAMathews/blog#44 & https://blog88227-remarkalpha.gtsb.io/ |
Beta Was this translation helpful? Give feedback.
-
Here is my PR for these changes, the site built locally and all tests pass ✅ newrelic/docs-website#1608 |
Beta Was this translation helpful? Give feedback.
-
I've made a bug report for the old MDX plugin and the issues it has with "complex" math formulas and what I did to work around it. I also made a repo with a minimal reproducible example for it. At the moment I don't have time to test out if the new changes fix the bugs. Could someone clone my repo and try it out? |
Beta Was this translation helpful? Give feedback.
-
@vladar Shouldn't the |
Beta Was this translation helpful? Give feedback.
-
Looking forward to when MDX v2 is published with support for remark 13. I'm currently using {
resolve: `gatsby-plugin-mdx`,
options: {
remarkPlugins: [require(`remark-math`)],
rehypePlugins: [require(`rehype-katex`)],
},
}, Since |
Beta Was this translation helpful? Give feedback.
-
I created a bug report a few weeks back after upgrading to adding here since it is related |
Beta Was this translation helpful? Give feedback.
-
Hey guys why remark-custom-blocks (dependency of as I can see remark is not a dependency of this package: https://github.com/zestedesavoir/zmarkdown/blob/zmarkdown%4011.2.2/packages/remark-custom-blocks/package.json#L31-L33 or am I missing something here? Edit: or should we use |
Beta Was this translation helpful? Give feedback.
-
Major bump of all remark plugins is coming
Remark has had a significant major upgrade recently and changed the underlying parser. The ecosystem seems to have almost caught up since then. We also upgraded Gatsby remark plugins.
The following plugins are now fully compatible with
remark@13
:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
Original PR: #29678
Incompatible plugins
Unfortunately
gatsby-remark-custom-blocks
is not compatible with remark13 yet because the underlyingremark-custom-blocks
package is not updated yet: zestedesavoir/zmarkdown#416One alternative is to use remark-directive. We don't provide a plugin for it yet, so if you're up to it - you can publish a new gatsby plugin for
remark-directive
support! Or useto-gatsby-remark-plugin
to convertremark-directive
to gatsby plugin.Still,
remark-directive
has a different syntax thanremark-custom-blocks
, so it will require manual migration of your markdown.Migration
We tried to make the upgrade effortless. But there could still be subtle differences in output and edge cases.
Most changes affect how lists are rendered. The new HTML output is more consistent in general. But in some cases, the new HTML structure may become inconsistent with your CSS selectors. So if you don't have screenshot-based tests for your projects we'd recommend checking the most important pages manually or by diffing the HTML of your builds.
The first build:
Then run the second build and diff:
gatsby build --no-uglify && diff -u -r public-first-build public
Known output changes
Make sure to check remark changelog for the full list of changes. Below we list some actual diffs we've seen while testing the new version.
1. List items separated by a newline are wrapped with paragraph
Take this markdown as an example:
HTML before:
HTML after:
But if you have a CSS rule like this:
li > strong { color: red }
- it will break.2. Nested lists are rendered without a wrapping paragraph (for tight lists)
Rendered as:
3. All list items are rendered consistently
If at least one list item contains a new line - every item in this list will be wrapped in a paragraph. The list is considered
tight
only if every list item occupies a single line. In this case, there will be no wrapping paragraphs.In the previous version, you could get mixed markup in list items (e.g. one item wrapped in a paragraph, but not the other).
4. White-spaces are trimmed
5.
<img alt="" />
attribute is always added withremark-images
6. Emails in the text are replaced with links
See remarkjs/remark#475
If you notice other changes like this, please let us know.
Beta Was this translation helpful? Give feedback.
All reactions