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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 BUG: Expression with leading comments get garbled on formatting #254

Closed
Princesseuh opened this issue Aug 8, 2022 · 0 comments 路 Fixed by #255
Closed

馃悰 BUG: Expression with leading comments get garbled on formatting #254

Princesseuh opened this issue Aug 8, 2022 · 0 comments 路 Fixed by #255

Comments

@Princesseuh
Copy link
Member

Princesseuh commented Aug 8, 2022

Describe the Bug

Found while running the plugin on the docs, the following:

{
	// For best cross-browser support of sticky or fixed elements, they must not be nested
	// inside elements that hide any overflow axis. The article content hides `overflow-x`,
	// so we must place the mobile TOC here.
	headers && (
		<nav class="mobile-toc">
			<TableOfContents
				client:media="(max-width: 72em)"
				headers={headers}
				labels={{ onThisPage: t('rightSidebar.onThisPage'), overview: t('rightSidebar.overview') }}
				isMobile={true}
			/>
		</nav>
	)
}

gets transformed to:

{For best cross-browser support of sticky or fixed elements, they must not be nested
	/
inside elements that hide any overflow axis. The article content hides `overflow-x`,
	/
so we must place the mobile TOC here.
	h
headers && (
	<nav class="mobile-toc">
		<TableOfContents
			client:media="(max-width: 72em)"
			headers={headers}
			labels={{ onThisPage: t('rightSidebar.onThisPage'), overview: t('rightSidebar.overview') }}
			isMobile={true}
		/>
	</nav>
)}

This kills the component.

What's expected

{
  // For best cross-browser support of sticky or fixed elements, they must not be nested
  // inside elements that hide any overflow axis. The article content hides `overflow-x`,
  // so we must place the mobile TOC here.
  headers && (
    <nav class="mobile-toc">
      <TableOfContents
        client:media="(max-width: 72em)"
        headers={headers}
        labels={{
          onThisPage: t("rightSidebar.onThisPage"),
          overview: t("rightSidebar.overview"),
        }}
        isMobile={true}
      />
    </nav>
  )
}

Steps to Reproduce

  1. Create an expression with a comment in it on the first lines and any content below
  2. Format
  3. Everything is broken!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant