-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Allow registering remark plugins #5633
Allow registering remark plugins #5633
Conversation
I think it's unrelated. Some tests are flaky on CI |
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.
Thanks @stefanprobst for this great PR and for adding tests and docs too!
I've added some comments, please let me know what you think.
packages/netlify-cms-widget-markdown/src/MarkdownControl/VisualEditor.js
Show resolved
Hide resolved
packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkPlugins.spec.js
Outdated
Show resolved
Hide resolved
packages/netlify-cms-widget-markdown/src/serializers/__tests__/remarkPlugins.spec.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Erez Rokah <[email protected]>
…/remarkPlugins.spec.js Co-authored-by: Erez Rokah <[email protected]>
…/remarkPlugins.spec.js Co-authored-by: Erez Rokah <[email protected]>
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.
This looks 🚀 @stefanprobst. I refactored the code a bit to pass the plugins as an option property instead of an additional argument.
e9f5cce
to
e7ba75f
Compare
Summary
This PR allows registering remark plugins (and presets) to customize how markdown is serialized/deserialized in the richtext editor.
Two usecases which have come up are (i) avoid saving autolinks for mdx-compatibility, and (ii) enforce formatting options.
fixes: #5516
related: #4601
did not mark #4601 as fixed, because this only affects how the richtext editor serializes to markdown. to enforce formatting for the markdown editor, the plaintext content would probably have to be run through a remark pipeline here but that means text would change while typing, which is odd (i also ran into issues where the textarea lost focus while typing when i tried it).
(sorry for the formatting chages, these were done by
yarn format
)Test plan
Added seriailzer tests.
Checklist
Please add a
x
inside each checkbox:yarn format
.yarn test
.