markdown-to-jsx icon indicating copy to clipboard operation
markdown-to-jsx copied to clipboard

An option to disable MD parsing inside custom components

Open ivan-kleshnin opened this issue 5 years ago • 2 comments

Hi!

I have a md code like:

<MyComponent>
  [ ] one
  [ ] two
</MyComponent>

I want those [ ] one to be used by MyComponent in some custom way. Unfortunately, they are handled by parser and turned to some predefined MD stuff early on.

Both overrides and createElement customizations are applied too late – I can customize rendering, but not parsing with them.

So I'm looking for an option to disable markdown parsing inside (at least) custom components.


There's an awkward workaround in the form of:

<MyComponent>
  ''' -- wrong quotes here just to render properly ;)
  [ ] one
  [ ] two
  '''
</MyComponent>

which is honestly a big hack.

  1. It's quite verbose and inconvenient to use for content authors
  2. Requires ReactDOMServer.renderToString calls on the client. Then I have to mess with <pre> and <code> wrappers to finally get my initial string 😨

ivan-kleshnin avatar Feb 26 '20 10:02 ivan-kleshnin

Hmm, I'm open to it as a config option if you can keep the bundle size delta small.

quantizor avatar May 20 '20 15:05 quantizor

same issue with codeblock,markdown to jsx will transfrom images in code block to real image

```

\`\`\`

but in common it will expected as:

<img src="./_assets/readme.md/MDinhuawei.com.png" width="200px" />

<!--or-->

<img src="./_assets/readme.md/MDinhuawei.com.png" style="height:200px" />

joebnb avatar Oct 12 '21 01:10 joebnb