/sauce

Embed snippets from source code on GitHub

Primary LanguageJavaScriptMIT LicenseMIT

Embed snippets from source code on GitHub using highlight.js and web components. All client side, all free and open source.

Importing

<script type='module' src="https://nrktkt.github.io/sauce/sauce.js"></script>
<script type='module' src="https://cdn.jsdelivr.net/gh/nrktkt/sauce@11.1.0/sauce.js"> </script>

Embedding a file

<sauce-code repo='nrktkt/sauce' file='example.html' lines='12:15'

Overriding the language detection

<sauce-code repo='nrktkt/sauce' file='example.html' lines='17:21'

Embedding a snippet from a file

<sauce-code repo='nrktkt/sauce' file='example.html' lines='23:27'

Changing the theme

You can find a list of themes here. The theme name is between the last / and the .min.css.
Previews of themes are here.

<sauce-code lang='html' repo='nrktkt/sauce' file='example.html' theme='monokai-sublime' lines='29:33'

Other goodies

The source file link after the snippet links directly to the specified lines in the file