4 ms·
>Not even to enrich a document, such as syntax-highlight the code snippets. This one may seem too stringent, but I think it’s better to err on the safe side, an
by bloaf 7y ago
>Not even to enrich a document, such as syntax-highlight the code snippets. This one may seem too stringent, but I think it’s better to err on the safe side, and it’s very easy to enforce.
If the enrichment rules are known ahead of time, there is no reason you can't just "hard code" the colors or formats into the document.
- fc81 7y agoI think that's what the author was going for. Syntax highlighting and other improvements would be "baked" into the document by the server and the final document would be served to the client. All without the use of client side scripting.
- rudedogg 7y agoYou can do this now with some static site generators.
- b0rsuk 7y agoIn theory, dynamic syntax highlighting done via Javascript lets you customize it on-the-fly, for example by choosing a syntax highlighting method that suits you. In practice, I've never seen a website with syntax highlighting that does it. So we're getting the worst of both worlds: no ability to tweak and syntax highlighting for the same page repeated millions of times. I find it especially ironic that Rust programming books use Javascript syntax highlighting. Doesn't Rust pride itself with cutting the runtime operations to absolute minimum? The one and only place where I want dynamic syntax highlighting is on "pages" where content might change, such as in-browser code interpreters. This kind of thing can't be done with static syntax highlighting: https://play.rust-lang.org/ https://play.rust-lang.org/