You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Quarto visual mode / source mode switching breaks equation block formatting and syntax highlighting #1047
The label {#eq-a-error-format} is placed on a new line with a leading space, making it unrecognizable to the Quarto cross-reference engine. Rendering the document produces:
Unable to resolve crossref @eq-a-error-format
Bug 2 — Lost syntax highlighting (gray background)
A correctly formatted single-line numbered equation:
renders correctly and cross-references work, but the equation block itself is not wrapped in the usual gray background box. Moreover, any R code blocks that follow this equation also lose their gray background.
Expected behavior:
Switching between visual and source mode should preserve the original multi-line equation block structure.
The {#eq-label} syntax should remain on the same line as the closing $$.
All code blocks should consistently display the gray background regardless of preceding equation formatting.
I have checked posit-dev/positron#8684 (comment). It seems to be related to the issue I am experiencing, but it looks like it has not been properly fixed yet.
My Quarto version is 1.9.38 and my Positron version is 2026.07.0.
I'd like to add that after the gray background of the R code chunk disappears, the outline view seems unable to correctly recognize the label of the R code chunk.
This is normal:
After the gray background of the R code chunk disappears:
By comparison, the first R code block always has a gray background. However, after a formula's gray background (here {#eq-lasso}) has problems, all code blocks following this formula will lose their gray background.
I've discovered a new issue, also related to visual mode / source mode switching. When switching from visual mode to source mode, the qmd file undergoes automatic formatting, but this formatting tends to collapse display math blocks, removing the newlines after and before the $$ delimiters. In this case, my formula was a multi-line mathematical expression, and I suspect that in some cases Pandoc requires the $$ delimiters for display math to occupy their own lines, which the current formatting ignores.
When rendered and previewed, it displays correctly, but this format confuses positron. Similarly, the gray background of code blocks and formulas disappears, and positron will not recognize subsequent headings. QUARTO:EQUATION will also fail to preview this formula:
The expected behavior should be as follows:
As the number of mathematical formulas written in qmd files increases, manually fixing these errors after switching from visual mode to source mode becomes increasingly troublesome.
I personally suggest that the short-term solution is to ensure that formula blocks always remain in multi-line format when transitioning from visual mode to source mode.
Activity
Vara326 commentedon Jul 9, 2026
I'd like to add that after the gray background of the R code chunk disappears, the outline view seems unable to correctly recognize the label of the R code chunk.
This is normal:
After the gray background of the R code chunk disappears:
By comparison, the first R code block always has a gray background. However, after a formula's gray background (here
{#eq-lasso}) has problems, all code blocks following this formula will lose their gray background.Vara326 commentedon Jul 19, 2026
I've discovered a new issue, also related to visual mode / source mode switching. When switching from visual mode to source mode, the qmd file undergoes automatic formatting, but this formatting tends to collapse display math blocks, removing the newlines after and before the
$$delimiters. In this case, my formula was a multi-line mathematical expression, and I suspect that in some cases Pandoc requires the$$delimiters for display math to occupy their own lines, which the current formatting ignores.The following format is correct:
But after switching from visual mode to source mode, it will be formatted as
When rendered and previewed, it displays correctly, but this format confuses positron. Similarly, the gray background of code blocks and formulas disappears, and positron will not recognize subsequent headings. QUARTO:EQUATION will also fail to preview this formula:
The expected behavior should be as follows:
As the number of mathematical formulas written in qmd files increases, manually fixing these errors after switching from visual mode to source mode becomes increasingly troublesome.
I personally suggest that the short-term solution is to ensure that formula blocks always remain in multi-line format when transitioning from visual mode to source mode.
volumen25 commentedon Aug 21, 2026
I have a similar problem with LaTeX when switching to the Visual Editor
becomes
Likewise, a table identifier:
becomes
more details here