asciidoctor / asciidoctor-browser-extension

:white_circle: An extension for web browsers that converts AsciiDoc files to HTML using Asciidoctor.js.
https://chrome.google.com/webstore/detail/asciidoctorjs-live-previe/iaalpfgpbocpdfblpnhhgllgbdbchmia
MIT License
219 stars 50 forks source link

Sup and sub aren't rendered as expected #641

Closed amelillo closed 1 year ago

amelillo commented 1 year ago

Hello. Trying to render a word and a super-or-sub-script phrase I can't get it to work. Example: Superman ^is a flying superhero^

isn't rendered as

Superman is a flying superhero

neither Superman ^^is a flying superhero^^

while

Superman ^is^ ^a^ ^flying^ ^superhero^

is. This happens with subscript as well, with or without a space after "superhero", btw, ReText renders it correctly with a constrained pair.

ggrossetie commented 1 year ago

Hey,

I don't think this is specifically related to the browser extension but rather to how AsciiDoc / Asciidoctor works. As you've described, subscript and superscript only apply to a word.

@mojavelinux might know about this design choice?

amelillo commented 1 year ago

I tried with asciidoctor-pdf via commandline and it's exactly an asciidoctor problem because the above phrase gets rendered as in the browser. Though, the AsciiDoc spec states that a constrained pair applies to sup and sub delimiters as well and that's why an editor like ReText renders it correctly using the latest version of pymarkups. It must be an asciidoctor problem.

mojavelinux commented 1 year ago

See https://docs.asciidoctor.org/asciidoc/latest/text/subscript-and-superscript/#subscript-and-superscript-syntax

amelillo commented 1 year ago

Thank you. I understand why, now, but I don't understand this choice. In my opinion, there are far less occurrences of the tilde and the caret with a meaning in some context than of a space in a sub or superscript, so it would be much more useful to escape them when needed than using an attribute substitution for each single space. Moreover, it's also easier to use a constrained pair for each word than typing four characters and hitting eight keys for each space, ain't it?

mojavelinux commented 1 year ago

I'm sorry you don't understand the choice, but it is not my responsibility to explain to you the years of experience with AsciiDoc that went into making the choice. If you feel very strongly about it, you can raise the issue with the AsciiDoc Language project when we get to the stage of discussing revisions to the syntax. For now, the syntax is not going to change you need to adhere to it if you want to use it.

amelillo commented 1 year ago

Sure I will. I can't understand it but I can easily respect it. I just thought that pointing it out could be the start of a reflection and not an annoyance.

mojavelinux commented 1 year ago

Thanks. I've added a note about it as something to look into as I begin work on the spec. You can trust that I think about the AsciiDoc syntax and ways to make it cleaner without breaking existing documents all the time. It's a tall order. But if there's a way to make this better, we'll get there.