0.1.18 • Published 3 years ago

embed-code v0.1.18

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

embed-code

A tiny component to render code with highlight.js inside of a terminal-like window.

How to embed the code

HOWTO

There are basically two ways of embedding the code. Both options will be using a simple JavaScript that is going to replace itself with the rendered code inside of a nice looking terminal window.

1. Plain text inside of the script tag

<script src="embed-code.js" type="text/javascript" data-lang="js">
function Welcome(props)
{
    return <h1>Hello, {props.name}</h1>;
}
</script>

2. JSON encoded data inside of the script tag

<script src="embed-code.js" type="text/javascript">
{"lang": "js", "code": "function Welcome(props)\n{\n    return <h1>Hello, {props.name}<\/h1>;\n}"}
</script>

The result will be looking like this:

The embedded code

CDN

The latest embed-code.js is available from unpkg.com:

https://unpkg.com/embed-code@latest/embed-code.js

WHY

I want to use this component in a Wordpress blog that's going to be filled from a github repository with markdown posts ...

0.1.18

3 years ago

0.1.17

3 years ago

0.1.16

4 years ago

0.1.14

4 years ago

0.1.15

4 years ago

0.1.11

4 years ago

0.1.12

4 years ago

0.1.13

4 years ago

0.1.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago