-
<Foo
bar="bar"
baz="baz"
>Lorem *ipsum*</Foo> and <Foo
bar="bar"
baz="baz"
>Lorem *ipsum*</
Foo> and <Foo
bar="bar"
baz="baz"
>
Lorem *ipsum*
</
Foo
> can be compiled into JSX codes in the playground. However, <Foo
bar="bar"
baz="baz"
>Lorem *ipsum*</Foo
> vomits the following error:
Line break just before https://html.spec.whatwg.org/multipage/syntax.html#end-tags Questio: is it intended that an end JSX tags allows whitespace only just after Prettier, the gold standard JS & HTML formatter (has not supported MDX v2+ yet though), formats HTML like: <a
href="https://example.com"
class="foo"
>bar</a
> https://prettier.io/blog/2018/11/07/1.15.0#whitespace-sensitive-formatting I like this format result because it complies with a line length rule without adding extra spaces. I want inline JSX to be formatted like this too. If MDX can parse the above "erroneous" input, inline JSX components with long names, attributes, or attribute values will be more likely to get opportunity to comply with a line length rule with keeping the compatibility with HTML. <LongNameComponent
longAttributeName="longAttributeValue"
anotherAttribute={12345}
>Long Child</LongNameComponent
>Some long text follows<AnotherComponent
>Another Child</AnotherComponent
>Some long text follows<br
/>New line |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hey @tats-u! 👋
To answer the broader question. MDX is Markdown + JSX. To your more specific question, should
be considered valid? The newline after can be supported as a block tag: <Foo
bar="bar"
baz="baz"
>
Lorem *ipsum*
</Foo
> sandbox: https://mdxjs.com/playground/
MDX does not contain HTML, and should not be formatted as HTML.
Prettier is aware and is working towards support prettier/prettier#12209 (as you seem to already be aware, as you've commented on that thread as well). |
Beta Was this translation helpful? Give feedback.
-
This isn’t about JSX, HTML, or XML.
Is a block quote. |
Beta Was this translation helpful? Give feedback.
This isn’t about JSX, HTML, or XML.
This is about markdown.
Is a block quote.