-
-
Notifications
You must be signed in to change notification settings - Fork 177
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
Mark down shortcuts for ``` does not work #290
Comments
The markdown shortcut plugin enables certain features based on the active plugins it detects when it is initialized. I think it will work if you move it to the bottom of the plugin list. Let me know if this works for you (need to put it in the docs), it works fine in the live demo. |
Thanks a lot @petyosi ! It worked! That was the issue. When I moved the markdown shortcut plugin to the bottom, everything worked. By the way, awesome plugin you have built here! I tried many editors yesterday before picking this up. This is the only plugin which was straightforward and easy to use. |
Hi, return (
<div style={{ width: "100%", textAlign: "left", padding: "12px" }}>
<MDXEditor
className={state.darkTheme ? "dark-theme dark-editor" : "light-theme"}
ref={ref}
markdown="# Instruction "
plugins={[
headingsPlugin(),
codeBlockPlugin({
defaultCodeBlockLanguage: "js",
}),
listsPlugin(),
codeMirrorPlugin({
codeBlockLanguages: { js: "JavaScript" },
}),
toolbarPlugin({
toolbarContents: () => (
<>
<InsertCodeBlock />
</>
),
}),
markdownShortcutPlugin(),
]}
/>
</div>
);
}; |
@lucas-vitrus it works as expected here? https://codesandbox.io/p/sandbox/dark-voice-mxgxcp. you need to type three backticks, |
it breaks if you don't specify any language. It doesn't default to |
I have the same issue, triple backticks with no language is valid markdown, but errors if I use that even with the default.
|
Thank you @petyosi ! It was the space missing. It makes sense to use My current working component for future reference: <MDXEditor
className="dark-theme dark-editor"
ref={ref}
markdown={props.markdown as string}
onChange={(markdown: string) => {
props.onChangeMarkdown(markdown);
}}
plugins={[
headingsPlugin(),
codeBlockPlugin({
defaultCodeBlockLanguage: "js",
}),
listsPlugin(),
codeMirrorPlugin({
codeBlockLanguages: {
js: "JavaScript",
css: "CSS",
txt: "text",
tsx: "TypeScript",
ts: "TypeScript",
},
}),
markdownShortcutPlugin(),
]}
/> |
I think entering a code block after pressing I'd also like the ability to add a more... simple code block? For my needs I don't need syntax highlighting or language setting. However if I try to initialize this without a language it errors out. Thanks. This is an awesome library. |
Can you please add a proper documentation for the plugin registration of code blocks. It is not clear in the docs that a Instead of starting with the sandpack implementation an example like:
|
Hi,
For me, the code block does not get activated when I type ```js. Here's what's hapenning:
Screen.Recording.2024-01-09.at.10.10.26.PM.mov
Here's my code:
This is a NextJS 14 project which use Typescript. To make things easier, I created a minimal reproduction of the issue: https://stackblitz.com/edit/nextjs-zmybjf?file=app%2Fglobals.css
The text was updated successfully, but these errors were encountered: