mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
* Update language-highlight.md * Update language-highlight.md Co-authored-by: 沈唁 <52o@qq52o.cn>
1.1 KiB
1.1 KiB
language highlight
docsify uses Prism to highlight code blocks in your pages. By default it only supports CSS, JavaScript and HTML. You can make Prism load additional languages:
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-bash.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-php.min.js"></script>
To use the new languages, make sure the code block label matches the part after prism- in the file name. FOr example, for prism-bash.js write a code block labeled with bash like this:
```bash
echo "hello"
```
?> Note that with GitHub-flavored markdown, sh and bash are effectively aliases of each other, but this is not the case with Prism. So using sh will not enable bash syntax in this case.
For prism-php.js, it would be:
```php
function getAdder(int $x): int
{
return 123;
}
```
?> Check the component files list for more options.