djot.js icon indicating copy to clipboard operation
djot.js copied to clipboard

Explicitly curled quotes not curling

Open adiabatic opened this issue 2 months ago • 2 comments

I was fooling around in the playground with explicitly curled quotes. Looks great! However, when I run djot at the command line, the quotes are, depending on your definition, straightened or not curled:

> npm install -g @djot/djot


added 1 package in 1s
> djot --version
djot 0.3.2
> printf "I like the Lemon Jelly album titled '}64–'}95.\n" | djot --from djot --to djot
I like the Lemon Jelly album titled '64–'95.

For what it's worth, pandoc doesn't straighten them either, and leaves the }s in, even when converting to Markdown or HTML:

> printf "I like the Lemon Jelly album titled '}64–'}95.\n" pandoc --from djot --to gfm --output -
I like the Lemon Jelly album titled '}64–'}95.
> printf "I like the Lemon Jelly album titled '}64–'}95.\n" pandoc --from djot --to html --output -
I like the Lemon Jelly album titled '}64–'}95.

Am I doing something wrong?

adiabatic avatar Nov 08 '25 20:11 adiabatic

In the case of djot, the parsed AST stores the original text, and the djot renderer just emits that again:

    smart_punctuation: (node : SmartPunctuation) => { this.lit(node.text); },

But the original text doesn't include the }. Without looking into this a lot more, I'm not sure what the best solution is.

In the case of pandoc, it looks like a bug in djot-hs, the library pandoc uses to parse djot. You can report it at jgm/djot-hs.

jgm avatar Nov 08 '25 20:11 jgm

But the original text doesn't include the }. Without looking into this a lot more, I'm not sure what the best solution is.

I was wondering if I could use djot as a quote curler for (snippets of) .dj files:

> printf "I like the Lemon Jelly album titled '}64–'}95.\n" | djot --from djot --to html
<p>I like the Lemon Jelly album titled ’64–’95.</p>

So I’d figure that the best option would be to curl the quote, and use djot-to-djot conversions as a “make this more Unicode” transformation.

adiabatic avatar Nov 09 '25 03:11 adiabatic