-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Italics and bold end at newline? #105
Comments
This happens because the CS interpreter works through your code line by line, running each code statement or printing each text line in turn (proper, carriage return lines that is - it's fine to use a text-editor that wraps). The [i] brackets are replaced with HTML "" tags and most modern browsers will attempt to automatically add any closing tags you miss (so that first part still works). The only way around this would probably be to immediately recollect all the printed text after a page render and reparse it as one chunk, replace the result and restore it to the screen. I'd sooner suggest just using two pairs: You could also store the value in a variable and use a tag line break, as that would all get parsed and printed together. For e.g. the following would work:
|
Those suggestions are all fine for shorter examples. In my case, I am using italics to indicate that a section is a flashback (which is pretty common). Having a It might pay to look at how a few markdown parsers do paragraphing, since it's similar in syntax. My initial suggestion was going to be to do two passes, basically: Identify commands and paragraphs, then run things through a formatting step. It's weirdly inconsistent, to me, that paragraphs join adjacent lines and get wrapped in Having Markdown in some many places has really, really spoiled me, I have to say. |
Agreed, it does look nasty but markdown parsers have the advantage of not needing to run code statements intermittently. Making it re-parse the text after statements (baring in mind that a statement can be cause for extra text to be printed), is pretty much what I'd suggested though. |
Oh sure. It always had to come down to @dfabulich making the call, regardless of the level of effort involved. I'm willing to put in some time trying to figure out a good restructure, but, of course, CoG would then have to maintain it, so... 🤷 |
I think the closest I'd get to fixing this bug is to at some point rewrite the UI into React or some other web framework that includes a virtual DOM, so I can rely on the library to do the "second pass" instead of keeping a buffer in memory and handling it myself. FWIW, we, ah, don't add |
If you write:
It will render as:
I haven't dug into the source to figure out what's doing the tag parsing and why it might be working this way, but would y'all accept a PR to make it render more intuitively (assuming I can figure it out)?
The text was updated successfully, but these errors were encountered: