You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -372,7 +372,7 @@ The default functionality of rendering code blocks would use `codeToHtml` from t
372
372
If you want to render the tokens into a code yourself, Shiki exposes two key methods to do that.
373
373
374
374
- `codeToThemedTokens` takes a code string and a language id and returns an array of tokens. A token represents a single part of the code, for example a keyword, a string, a comment, etc.
375
-
- `renderToHTML` takes an array of tokens and returns an HTML string that represents the provided code.
375
+
- `renderToHtml` takes an array of tokens and returns an HTML string that represents the provided code.
376
376
377
377
```js
378
378
importshiki, { getHighlighter } from'shiki'
@@ -389,15 +389,15 @@ const code = `console.log("Here is your code.");`
// This will return an HTML string that represents the provided code.
392
-
consthtml=shiki.renderToHTML(tokens)
392
+
consthtml=shiki.renderToHtml(tokens)
393
393
```
394
394
395
-
Alternatively you can add to `renderToHTML` the desired element shape for `pre`, `code`, `line (span)`, and `token (span)`, and override the theme colors for background and foreground.
395
+
Alternatively you can add to `renderToHtml` the desired element shape for `pre`, `code`, `line (span)`, and `token (span)`, and override the theme colors for background and foreground.
396
396
397
397
For more about that, or to build your own renderer, check out the implementation in [shiki](./packages/shiki/src/renderer.ts).
398
398
399
399
```js
400
-
consthtml=shiki.renderToHTML(tokens, {
400
+
consthtml=shiki.renderToHtml(tokens, {
401
401
fg:highlighter.getForegroundColor('nord'), // Set a specific foreground color.
402
402
bg:highlighter.getBackgroundColor('nord'), // Set a specific background color.
403
403
// Specified elements override the default elements.
0 commit comments