[remark] How to do inline code? #785
-
Hello! I'm getting started with this (amazing) library, and I'm planning on using both inline and block code snippets heavily. However, I cannot seem to figure out how inline code snippets work. I've recreated the example under However, there is no example in the docs that shows inline code. If I want to do this: const mrkdwn = `# My Article
I'm talking about some code that looks like this ~const noOp = () => {}~!` The resulting HTML is just: <p>I'm talking about some code that looks like this ~const noOp = () => {}~!</p> I tried looking at the I'd be very grateful if someone could point me in the right direction. Also happy to make a PR to update the docs myself if there's an answer :) Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
While fenced code blocks can use (three) tildes, inline code can only use ticks: You could switch to using strings with single or double quotes in JavaScript, to use backticks in a string. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the kind words @WillowP! const mrkdwn = `# My Article
I'm talking about some code that looks like this \`const noOp = () => {}\`!` runnable example: https://codesandbox.io/s/react-markdown-debug-forked-253d7 |
Beta Was this translation helpful? Give feedback.
-
Wow, thanks for the fast responses. This is working like a dream now. |
Beta Was this translation helpful? Give feedback.
Thanks for the kind words @WillowP!
Inline code snippets use backticks https://commonmark.org/help/
runnable example: https://codesandbox.io/s/react-markdown-debug-forked-253d7