10 ms·
Neat idea, though as I was playing around with it I noticed right away that the following seems to be impossible (or else very non-obvious) via Aftertext: "How
by yellowapple 5y ago
Neat idea, though as I was playing around with it I noticed right away that the following seems to be impossible (or else very non-obvious) via Aftertext:
"How much wood could a woodchuck chuck if a woodchuck could chuck wood?"
I tried
How much wood could a woodchuck chuck if a woodchuck could chuck wood?
italics wood
italics wood
which only seemed to italicize the first "wood", and
How much wood could a woodchuck chuck if a woodchuck could chuck wood?
italics wood wood
which obviously failed because it can't find the substring "wood wood". And of course neither of these would match the "wood" in either of the "woodchuck" instances, so no italicization there, either.
- phnofive 5y agoaftertext How much wood could a woodchuck chuck if a woodchuck could chuck wood? italics [-6:-3,10:13,23:26,43:46]
- dspillett 5y agoThat looks very inflexible for later edits, marking characters or words means a potentially cumbersome recounting if something is reworded or just if a typo is fixed. Also, I get the second and subsequent number issue are the three locations to highlight, but what instruction does the first, -6:-3, give to the formatter in your example?
- dejj 5y agoNot a big fan of byte/rune counting. Maybe regex. Maybe more verbosity, like: aftertext How much wood could a woodchuck chuck if a woodchuck could chuck wood? context How much wood italics wood context could a woodchuck italics wood context a woodchuck could italics wood context chuck wood italics wood
- doovd 5y agoThis is horrific, imagine changing your text and having to update the indices
- breck 5y agoIt starts getting clunky but I added some new keywords to handle the multiple hits scenarios: match and matchAll. Demo: https://try.scroll.pub/#scroll%0A%20aftertext%0A%20%20How%20much%20wood%20can%20a%20woodchuck%20chuck%20if%20a%20woodchuck%20could%20chuck%20wood%3F%0A%20%20link%20https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGroundhog%20woodchuck%0A%20%20%20matchAll%0A%20%20class%20standout%20wood%0A%20%20%20match%200%203%0A%20%0A%20css%0A%20%20.standout%20%7B%0A%20%20%20background-color%3A%20yellow%3B%0A%20%20%20border%3A%201px%20dashed%20red%3B%0A%20%20%20padding%3A%205px%3B%0A%20%20%7D https://try.scroll.pub/#scroll%0A%20aftertext%0A%20%20How%20...