The more fundamental question for me is why the author didn't decide to make make code blocks non-breaking by default, or just add the class annotations when he writes the HTML?
tyho 13 hours ago [-]
You can absolutely parse HTML with regex, so long as the document is finite in length. Every finite language is regular, hence can be parsed with regex's.
magicalist 12 hours ago [-]
Zalgo and situational subset parsing aside:
> You can absolutely parse HTML with regex, so long as the document is finite in length
This isn't sufficient, unless I'm misinterpreting what you're saying. It's not enough to have documents of finite length (all documents are finite in length), you need documents with a max length, so you have a finite number of possible documents to parse.
vrighter 39 minutes ago [-]
and you write your regex specifically for that document length, handling all possible nesting combinations. combinatoric explosion
gpvos 13 hours ago [-]
Do a web search for the parent of your comment, read the Stackoverflow answer. It's a classic. Learn about Zalgo and Tony the pony, he comes.
12 hours ago [-]
matheusmoreira 14 hours ago [-]
Tony the pony, he comes.
timedude 13 hours ago [-]
What do you mean you can't. I do it all the time
throw1234567891 13 hours ago [-]
You do some parts all the time.
prmoustache 13 hours ago [-]
I do not count substitution as "parsing"
pwdisswordfishq 13 hours ago [-]
Why even bother with the CSS class? Just apply text-wrap: nowrap; to all <code> elements and dispense with the fragile regex parsing.
dajtxx 3 hours ago [-]
The 5 cm example had a line break between the 5 and the cm when I read the page in my phone. A joke?
pimlottc 12 hours ago [-]
Unfortunately this makes it much harder to read on narrow-width screens (e.g. mobile), where the use must scroll horizontally
And also
> Nov, 2020
And then, StackOverflow asks itself why it looses users.
The more fundamental question for me is why the author didn't decide to make make code blocks non-breaking by default, or just add the class annotations when he writes the HTML?
> You can absolutely parse HTML with regex, so long as the document is finite in length
This isn't sufficient, unless I'm misinterpreting what you're saying. It's not enough to have documents of finite length (all documents are finite in length), you need documents with a max length, so you have a finite number of possible documents to parse.