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

stateFromMarkdown() adds code inline style inside code block #244

Open
edwindwalker opened this issue Aug 17, 2021 · 0 comments
Open

stateFromMarkdown() adds code inline style inside code block #244

edwindwalker opened this issue Aug 17, 2021 · 0 comments

Comments

@edwindwalker
Copy link

edwindwalker commented Aug 17, 2021

A very simple reproduction case:

import { stateFromMarkdown } from "draft-js-import-markdown";
import { convertToRaw } from "draft-js";

const editorContent = stateFromMarkdown("```\n1\n2\n3\n```");
console.log(convertToRaw(editorContent));

The output is:

{"blocks":[{"key":"cd9fm","text":"1\n2\n3","type":"code-block","depth":0,"inlineStyleRanges":[{"offset":0,"length":5,"style":"CODE"}],"entityRanges":[],"data":{}}],"entityMap":{}} 

This doesn't seem like the correct result. The block element should be sufficient to enforce the correct styling.

From the source code:

return new ElementNode('pre', preAttrs, [codeNode]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant