x-postpress-code
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "x-postpress-code", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A web component used for code highlighting.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/kherrick/x-postpress-code", |
@@ -5,15 +5,7 @@ # x-postpress-code | ||
## Usage | ||
Use the type attribute and include the source in the default slot with `pre` tags to render static content: | ||
## Example usages | ||
Pass a source url: | ||
```html | ||
<x-postpress-code type="js" src="https://example.com/example.js"></x-postpress-code> | ||
``` | ||
Include the source in the default slot (inside `pre` tags): | ||
```html | ||
<x-postpress-code type="bash"><pre> | ||
@@ -26,1 +18,47 @@ #/usr/bin/env bash | ||
``` | ||
Lazy load the code to be highlighted by using both the type and src attributes: | ||
```html | ||
<x-postpress-code | ||
src="https://example.com/example.js" | ||
type="js" | ||
></x-postpress-code> | ||
``` | ||
## Installation | ||
### from unpkg: | ||
```html | ||
<script | ||
src="https://unpkg.com/x-postpress-code" | ||
type="module" | ||
></script> | ||
``` | ||
### from npm: | ||
```bash | ||
npm i x-postpress-code | ||
``` | ||
```js | ||
import 'x-postpress-code' | ||
``` | ||
## Using the following highlight.js languages: | ||
* `bash` | ||
* `c` | ||
* `cpp` | ||
* `css` | ||
* `javascript` | ||
* `json` | ||
* `markdown` | ||
* `php` | ||
* `plaintext` | ||
* `python` | ||
* `shell` | ||
* `typescript` | ||
* `xml` |
92631
63