remoteinterview / zero

Zero is a web server to simplify web development.
https://zeroserver.io/
Apache License 2.0
5.84k stars 243 forks source link

md support is very touchy #31

Closed Fil closed 5 years ago

Fil commented 5 years ago

test.md containing <img src="toto.png">

yields:

  20 |              components={components}>
  21 | <img src="toto.png">
> 22 |            </MDXTag>
     |                    ^
  23 |   }
  24 | }
  25 | MDXContent.isMDXComponent = true
✺ Updating packages(node:23129) UnhandledPromiseRejectionWarning: SyntaxError: Unterminated JSX contents (19:20)

fixed with

<img src="toto.png" />

but markdown is more tolerant usually :)

asadm commented 5 years ago

I feel that's because zero uses mdxjs.com. This helps in supporting dynamic markdown: JSX in markdown, import one .md to another etc. So that img tag is probably parsed as JSX rather than HTML.

abritinthebay commented 5 years ago

This is because MDX is JSX inside MD, and JSX is XML compliant - which means you need closing tags. Like XHTML.

It's not a bug, it's working as expected. In fact it's the only way MDX could work.

Fil commented 5 years ago

I understand that’s how it works and should work for mdx files. Consequence maybe we need a different approach for md files?

Le sam. 9 mars 2019 à 00:07, Gregory Wild-Smith notifications@github.com a écrit :

This is because MDX is JSX inside MD, and JSX is XML compliant - which means you need closing tags. Like XHTML.

It's not a bug, it's working as expected. In fact it's the only way MDX could work.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/remoteinterview/zero/issues/31#issuecomment-471107578, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAbWTAW6uS9x4rgFjAu9rhqU4ePfb5fks5vUu0WgaJpZM4bd8r4 .

-- -- Fil