This repository was archived by the owner on Feb 7, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,53 @@ | ||
# Languages | ||
|
||
## Bundled Languages | ||
|
||
Language grammars listed below are re-distributed via [`tm-grammars`](https://github.com/antfu/textmate-grammars-themes/tree/main/packages/tm-grammars) into the `shikiji` package. | ||
|
||
<LanguagesList /> | ||
|
||
Grammars are covered by their repositories’ respective licenses, which are permissive (apache-2.0, mit, etc), and made available in [this NOTICE](https://github.com/antfu/textmate-grammars-themes/blob/main/packages/tm-grammars/NOTICE). | ||
|
||
For loading your custom languages, please reference to [this guide](/guide/load-lang). | ||
|
||
## Special Languages | ||
|
||
### Plain Text | ||
|
||
You can set lang to `text` to bypass highlighting. This is useful as the fallback when you receive user specified language that are not available. For example: | ||
|
||
```txt | ||
import { codeToHtml } from 'shikiji' | ||
const html = codeToHtml('console.log("Hello World")', { | ||
lang: 'text', // [!code hl] | ||
theme: 'vitesse-light', | ||
}) | ||
``` | ||
|
||
`txt`, `plain` are provided as aliases to `text` as well. | ||
|
||
### ANSI | ||
|
||
A special processed language `ansi` is provided to highlight terminal outputs. For example: | ||
|
||
```ansi | ||
[0;90m┌[0m [0;36;1mWelcome to VitePress. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
# Themes | ||
|
||
## Bundled Themes | ||
|
||
Themes listed below are re-distributed via [`tm-themes`](https://github.com/antfu/textmate-grammars-themes/tree/main/packages/tm-themes) into the `shikiji` package. | ||
|
||
<ThemesList /> | ||
|
||
Themes are covered by their repositories’ respective licenses, which are permissive (apache-2.0, mit, etc), and made available in [this NOTICE](https://github.com/antfu/textmate-grammars-themes/blob/main/packages/tm-themes/NOTICE). | ||
|
||
For loading your custom themes, please reference to [this guide](/guide/load-theme). | ||
|
||
## Special Themes | ||
|
||
You can set theme to `none` to bypass highlighting. This is useful as the fallback when you receive user specified theme names that are not available. For example: | ||
|
||
```ts twoslash theme:none | ||
import { codeToHtml } from 'shikiji' | ||
|
||
const html = codeToHtml('console.log("Hello World")', { | ||
lang: 'javascript', | ||
theme: 'none', // [!code hl] | ||
}) | ||
``` | ||
|