tiptap
tiptap copied to clipboard
Prevent overriding default renderToMarkdown options
Changes Overview
The renderToMarkdown function options are being spread in a way that will override the default nodeMapping or markMapping options when provided
So there is no way to simply override one node or mark mapping without overriding all of them.
Implementation Approach
Simply destructuring the options and spreading specifically to nodeMapping and markMapping to prevent the final ...options from overriding the defaults
Verification Steps
Add a single custom or default override to nodeMapping
Ex:
renderToMarkdown({
content: editor.getJSON(),
extensions: editor.extensionManager.extensions,
options: {
nodeMapping: {
templateInput: (props) => {
return `{{${props.node.attrs.inputName}}}`;
},
},
},
});
See that other default nodeMappings like listItems, headings etc are still rendered to markdown as expected
Additional Notes
Checklist
- [X] I have created a changeset for this PR if necessary.
- [X] My changes do not break the library.
- [X] I have added tests where applicable.
- [X] I have followed the project guidelines.
- [X] I have fixed any lint issues.
⚠️ No Changeset found
Latest commit: c219be0faf22a51a632039d7565d704b53794d99
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Deploy Preview for tiptap-embed ready!
| Name | Link |
|---|---|
| Latest commit | c219be0faf22a51a632039d7565d704b53794d99 |
| Latest deploy log | https://app.netlify.com/projects/tiptap-embed/deploys/685963d54621c800080b77e5 |
| Deploy Preview | https://deploy-preview-6375--tiptap-embed.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
@bdbch should this just be closed per
This is not a full implementation of a markdown renderer..
For people wanting to extend from this starting point they'll just need to copy the source code and adjust (which is what I have done)
I also know there is more direct markdown support coming in the future so understand if this doesn't make sense to change at this time
On the other hand, this is a really small change that does allow extending this function without copying the full source code 🤷