Skip to content

Display math inside a blockquote has its > prefix doubled on round trip #181

@rundel

Description

@rundel

A $$ ... $$ display-math block placed inside a blockquote parses with the blockquote > prefix retained inside the math content string (e.g. "\n> p = q\n> "). The qmd writer then re-prefixes every line with > when emitting the blockquote, producing > > p = q and > > $$. Each pass through the round trip adds another > level.

$ printf '> Before\n> $$\n> p = q\n> $$\n> After\n'
> Before
> $$
> p = q
> $$
> After

$ printf '> Before\n> $$\n> p = q\n> $$\n> After\n' | cargo run --bin pampa --
[ BlockQuote [Para [Str "Before", SoftBreak, Math DisplayMath "\n> p = q\n> ", SoftBreak, Str "After"]] ]

$ printf '> Before\n> $$\n> p = q\n> $$\n> After\n' | cargo run --bin pampa -- -t qmd
> Before
> $$
> > p = q
> > $$
> After

$ printf '> Before\n> $$\n> p = q\n> $$\n> After\n' | cargo run --bin pampa -- -t qmd | cargo run --bin pampa --
[ BlockQuote [Para [Str "Before", SoftBreak, Math DisplayMath "\n> > p = q\n> > ", SoftBreak, Str "After"]] ]

This seems like a parser bug (math content retains the blockquote prefix bytes) rather than a writer bug.

From quarto-web:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreaders-writersParsing issues, round-trip discrepancies, writer bugs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions