Quantcast
Viewing latest article 25
Browse Latest Browse All 39

Answer by Lionel Rowe for Goodbye, Prettify. Hello highlight.js! Swapping out our Syntax Highlighter

Will lazy loading of syntaxes be supported?

This would allow for syntax highlighting of less common languages that don't need to be eager-loaded on every page load.

Here's a proof-of-concept that doubles as a Tampermonkey user-script:

Highlight.js lazy-loading proof of concept

Naturally it's a little hacky, but it works on all of the following examples:

```lang-diff

- print('failure')+ print('success')

```lang-elixir

spawn_link(fn ->  send(current_process, {:msg, "hello world"})end)receive do  {:msg, contents} -> IO.puts(contents)end

```lang-bf

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

Viewing latest article 25
Browse Latest Browse All 39

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>