Closed tsmethurst closed 1 year ago
Seems like SmartyPants treats common fractions differently from arbitrary fractions:
expected: "<p>Some fractions are 1/2 1/3 2/3 1/4 3/4 1/5 2/5 3/5 4/5</p>"
actual : "<p>Some fractions are ½ 1/3 2/3 ¼ ¾ 1/5 2/5 3/5 4/5</p>"
Should all fractions be disabled, or the common ones that are displayable as single entities OK?
Should all fractions be disabled
imo yes, if it's possible, since i think it's behavior most people won't want
Should all fractions be disabled
imo yes, if it's possible
Annoyingly, the upstream package logic has no option to disable fractions processing entirely without disabling SmartyPants processing as a whole.
Either smart fractions is on, where you get the sup/sub output behaviour, or off, and you get HTML entity processing. A second round of parsing to strip out these blacklisted entities can't differentiate between user inputted entities and smartypants generated ones.
oh that's a bummer, how silly! got any ideas about what the best behavior would be then?
oh that's a bummer, how silly! got any ideas about what the best behavior would be then?
What aspects of SmartyPants parsing are actually needed? Would anything significant (e.g. ampersand escaping) be lost by disabling SmartyPants altogether?
What aspects of SmartyPants parsing are actually needed
I kinda like the aesthetics of having "
marks be angled nicely. And automatic em dashes. But actually none of that is necessary at all, so maybe we should just turn it off entirely :P What do you reckon?
As a backend-first project, I think disabling it altogether is sensible - and it's up to whatever frontend is rendering the data to choose to have fancy angled quotes and better dashes.
Alright :) I don't think anyone will mind or even really notice if we disable it, and if that's the only way we can avoid having the silly fraction parsing, then I'm all for it!
rn the markdown library we use turns
1/5
into<sup>1</sup>⁄<sub>5</sub>
which is actually quite annoyingwe should change this behavior in here somewhere + add tests for it: https://github.com/superseriousbusiness/gotosocial/blob/main/internal/text/markdown.go