-
Notifications
You must be signed in to change notification settings - Fork 27
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
add colored text blocks #237
Conversation
Deploying ferrous-systems-rust-training with
|
Latest commit: |
73940fc
|
Status: | ✅ Deploy successful! |
Preview URL: | https://762a9f5a.ferrous-systems-rust-training.pages.dev |
Branch Preview URL: | https://colored-text.ferrous-systems-rust-training.pages.dev |
Updating top post: Aha, Gnome terminal allows one to |
If I understand correctly, the colors are set to whatever the code editor or terminal have been set to when the author presses "Copy", and text blocks from different authors would have different colors if their local editor / terminal themes do not match. Maybe we have to have a standardized set of colors to use for different roles in text and do a manual after pass to fix them before publishing. Using Ferrous palette would be preferable. Definitely needs an internal discussion. |
I think using HTML is OK - these blocks will not change often. Although it might be better to use a style sheet, and then we can have different light-mode/dark-mode versions. You can insert the styles into |
Also The other option, which I regret even as I type it out, is to store the text as plain text with ANSI escape codes on disk, use something like |
Now that #242 is ready for review, I'm closing this PR in favor of that fully fleshed out one. |
Fixes #232.
Draft mode while checking out the proof of principle, once that's OK'd I'll go and change the other text blocks, of which there are only 12.
Proposed solution:
Insert raw HTML under
<code no-escape>
so that the HTML color codes aren't escaped. To get said raw HTML, you can usegnome-terminal
, right-clickingCopy as HTML
and pasting that.On macOS, I found VSCode lets you select, then right -click
Copy as HTML
when the error is output from the integrated terminal, and then selectingPaste As > Insert HTML
.Downside:
The source code looks uuuuuugly 🤮 .
Picture 1: What it looks like in browser.
Picture 2: What it looks like as slides
Alternative solution
Use this crate (which is what the compiler team uses) https://docs.rs/anstyle-svg/latest/anstyle_svg/#example, though I don't see how serving SVGs is much better as an overall workflow.