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

contents of multi line strings get parsed as markdown #357

Closed
giladv opened this issue Dec 12, 2018 · 6 comments
Closed

contents of multi line strings get parsed as markdown #357

giladv opened this issue Dec 12, 2018 · 6 comments
Labels
🐛 type/bug This is a problem

Comments

@giladv
Copy link

giladv commented Dec 12, 2018

osx 10.13
mdx loader 0.16.6
node 9.10

the following will throw an unexpected token error

<MyCodeBlockComp>{`
   some display code

   more display code
`}</MyCodeBlockComp>

this will also happen if the multi line string would be passed as a prop and not as children

internally i can see it tried to wrap the 'more display code' line inside a MDX paragraph although its inside JS string.

if this is by design - how am i suppose to pass multi line strings to components?
let's say a code block component which accepts lines to highlight so i cant use the built in ``` syntax.

@giladv
Copy link
Author

giladv commented Dec 30, 2018

hello,
any news regarding this issue?
could understand from #345 the status

also, is there any other option fo multi line content with js?
thanks!

@ChristopherBiscardi
Copy link
Member

let's say a code block component which accepts lines to highlight so i cant use the built in ``` syntax.

Without addressing the original multiline-string issue, you can accomplish this with the built-in codeblock syntax. If you write it like:

markdown meta block

If you look at the above example, you will end up with a prop named highlight that includes the string 1,4-5,19 as its value. You can then process and highlight as desired with your preferred method (such as prism-react-renderer, etc)

@giladv
Copy link
Author

giladv commented Jan 2, 2019

thanks i'll try that

@johno
Copy link
Member

johno commented Feb 15, 2019

Going to close this since we can track the progress of this parsing bug in #195. Thanks for opening up the issue!

@johno johno closed this as completed Feb 15, 2019
@Stvad

This comment has been minimized.

@ChristianMurphy
Copy link
Member

@Stvad https://github.com/mdx-js/mdx/discussions is a good place to ask questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 type/bug This is a problem
Development

No branches or pull requests

5 participants