Skip to content

Commit 8722156

Browse files
committed
docs: updates
1 parent 289bd64 commit 8722156

File tree

2 files changed

+27
-13
lines changed

2 files changed

+27
-13
lines changed

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ The code is highlighted without having to wrap a bunch of `<span>` elements arou
1717
<br>
1818
</div>
1919

20+
## Examples
21+
22+
For examples checkout the [CodePen &lt;syntax-highlight&gt; collection](https://codepen.io/collection/EPYpMJ).
23+
2024
## Install
2125

2226
Install via npm
@@ -71,24 +75,27 @@ Currently there are only limited [themes](https://github.com/andreruffert/syntax
7175
/**
7276
* @typedef Config
7377
* @type {object}
74-
* @property {string[]} languages - Language grammars to highlight.
75-
* @property {{ [key: string]: string[] }} languageTokens - Language specific token types.
78+
* @property {string[]} languages - List of languages to support for syntax highlighting.
79+
* @property {string[]} tokenTypes - Token types used during lexing/parsing.
80+
* @property {{[key: string]: string[]}} languageTokens - Mapping of language names to their specific tokenization rules.
81+
* @property {function} setup - Runs before the custom element gets defined in the registry.
82+
* @property {function} tokenize - Tokenize text based on the specified language grammar
7683
*/
7784

7885
window.she = window.she || {};
7986

8087
/** @type {Config} */
8188
window.she.config = {
8289
languages: ['markup', 'css', 'javascript'], // Default
90+
tokenTypes: [],
91+
languageTokens: {},
92+
setup: async () => {},
93+
tokenize: (text, language) => [],
8394
};
8495
```
8596

8697
Full list of all [languages supported](https://prismjs.com/#supported-languages) by the prism tokenizer.
8798

88-
## Examples
89-
90-
For examples checkout the [CodePen &lt;syntax-highlight&gt; collection](https://codepen.io/collection/EPYpMJ).
91-
9299
## Browser Support
93100

94101
<picture>

docs/index.html

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ <h2 class="playground-title">Demo Playground</h2>
9696
</div>
9797
</section>
9898

99+
<section data-section="content">
100+
<h1>Examples</h1>
101+
<p>For more examples checkout the CodePen <a href="https://codepen.io/collection/EPYpMJ" target="_blank" rel="noreferrer">&lt;syntax-highlight&gt; collection</a>.</p>
102+
</section>
103+
99104
<section data-section="content">
100105
<h1>Installation &amp; Usage</h1>
101106
<article>
@@ -161,15 +166,22 @@ <h1>Configuration</h1>
161166
<syntax-highlight language="js" id="copy-config">/**
162167
* @typedef Config
163168
* @type {object}
164-
* @property {string[]} languages - Prism languages.
165-
* @property {{ [key: string]: string[] }} languageTokens - Language specific token types.
169+
* @property {string[]} languages - List of languages to support for syntax highlighting.
170+
* @property {string[]} tokenTypes - Token types used during lexing/parsing.
171+
* @property {{[key: string]: string[]}} languageTokens - Mapping of language names to their specific tokenization rules.
172+
* @property {function} setup - Runs before the custom element gets defined in the registry.
173+
* @property {function} tokenize - Tokenize text based on the specified language grammar
166174
*/
167175

168176
window.she = window.she || {};
169177

170178
/** @type {Config} */
171179
window.she.config = {
172180
languages: ['markup', 'css', 'javascript'], // Default
181+
tokenTypes: [],
182+
languageTokens: {},
183+
setup: async () => {},
184+
tokenize: (text, language) => [],
173185
};</syntax-highlight>
174186
<clipboard-copy for="copy-config" class="button" aria-label="Copy content">
175187
<svg class="icon" width="1em" height="1em" aria-hidden="true"><use xlink:href="#copy"></use></svg>
@@ -178,11 +190,6 @@ <h1>Configuration</h1>
178190
<p>Full list of all <a href="https://prismjs.com/#supported-languages" target="_blank" rel="noreferrer">languages supported</a> by the prism tokenizer.</p>
179191
</section>
180192

181-
<section data-section="content">
182-
<h1>Examples</h1>
183-
<p>For more examples checkout the CodePen <a href="https://codepen.io/collection/EPYpMJ" target="_blank" rel="noreferrer">&lt;syntax-highlight&gt; collection</a>.</p>
184-
</section>
185-
186193
<section data-section="content">
187194
<h1>Credits</h1>
188195
<ul>

0 commit comments

Comments
 (0)