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

Allow registering remark plugins #5633

Merged
merged 17 commits into from
Jul 25, 2021

Conversation

stefanprobst
Copy link
Contributor

@stefanprobst stefanprobst commented Jul 21, 2021

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:

  • I have read the contribution guidelines.
  • Code is formatted via running yarn format.
  • Tests are passing via running yarn test.
  • The status checks are successful (continuous integration). Those can be seen below.

@stefanprobst stefanprobst requested a review from a team July 21, 2021 09:35
@erezrokah erezrokah added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Jul 21, 2021
@stefanprobst
Copy link
Contributor Author

hmm not sure about the failing e2e test - it seems to work fine running locally
Screenshot_20210721_143937

@erezrokah
Copy link
Contributor

hmm not sure about the failing e2e test - it seems to work fine running locally

I think it's unrelated. Some tests are flaky on CI

Copy link
Contributor

@erezrokah erezrokah left a 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.

Copy link
Contributor

@erezrokah erezrokah left a 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.

@erezrokah erezrokah force-pushed the feat/allow-remark-plugins branch from e9f5cce to e7ba75f Compare July 25, 2021 12:22
@erezrokah erezrokah merged commit 437f4bc into decaporg:master Jul 25, 2021
@stefanprobst stefanprobst deleted the feat/allow-remark-plugins branch July 25, 2021 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

markdown widget should avoid serializing links as autolinks for mdx compatibility
2 participants