add support of prism plugins
This commit is contained in:
parent
1e56cbb634
commit
4d442fee37
8
book.xml
8
book.xml
@ -11,6 +11,10 @@
|
|||||||
|
|
||||||
<book_name>ph-Bookshelf Wiki</book_name>
|
<book_name>ph-Bookshelf Wiki</book_name>
|
||||||
|
|
||||||
|
<configurations>
|
||||||
|
<prism.plugins>autolinker</prism.plugins>
|
||||||
|
</configurations>
|
||||||
|
|
||||||
<contents>
|
<contents>
|
||||||
|
|
||||||
<Page id="ph-bookshelf">the ph-Bookshelf</Page>
|
<Page id="ph-bookshelf">the ph-Bookshelf</Page>
|
||||||
@ -20,8 +24,8 @@
|
|||||||
|
|
||||||
<Chapter root="tools/">
|
<Chapter root="tools/">
|
||||||
<caption>页面选项</caption>
|
<caption>页面选项</caption>
|
||||||
<Page id="code-highlight">代码高亮</Page>
|
<Page id="code-highlight"><![CDATA[<small>Prism </small>代码高亮]]></Page>
|
||||||
<Page id="code-highlight">RegEx 高亮着色</Page>
|
<Page id="regex-highlight">RegEx 高亮着色</Page>
|
||||||
</Chapter>
|
</Chapter>
|
||||||
<Chapter>
|
<Chapter>
|
||||||
<caption>站点配置选项</caption>
|
<caption>站点配置选项</caption>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: 代码块高亮
|
title: 代码高亮
|
||||||
---
|
---
|
||||||
|
|
||||||
# <small>基于 Prism 的</small> 代码块高亮支持
|
# <small>基于 Prism 的</small> 代码块高亮支持
|
||||||
@ -20,6 +20,18 @@ Prism 不会自动为所有代码块着色,所以不指定 `language-xxx` 即
|
|||||||
|
|
||||||
// todo
|
// todo
|
||||||
|
|
||||||
|
## 添加 Prism 插件
|
||||||
|
|
||||||
|
ph-Bookshelf 还添加了可以方便的引入 Prism 的官方扩展插件的支持,你可以借此扩展代码高亮/代码块的使用方式。
|
||||||
|
|
||||||
|
只需要使用配置字段 `prism.plugins` 声明你需要的插件,每个语言名称之间通过 `;` 来分隔, ph-Bookshelf 即会自动加载这些插件。
|
||||||
|
|
||||||
|
ph-Bookshelf 可以合并不同位置的配置字段:所以在 *book.xml* 设置了 `line-numbers; autolinker`,在页面内设置了 `command-line` 后,最后在这个页面内,将会导入 `line-numbers` `autolinker` `command-line` 三个。
|
||||||
|
|
||||||
|
> 通过 `prism.plugins` 导入的插件最终将会向页面导入 `https://cdn.jsdelivr.net/npm/prismjs@v1.x/plugins/{$plugin}/prism-{$plugin}.min.js`{.lang-url} 和 `https://cdn.jsdelivr.net/npm/prismjs@v1.x/plugins/{$plugin}/prism-{$plugin}.min.css`{.lang-url} 两个文件。这在导入 Prism 官方插件的一般情况下都可以使用。
|
||||||
|
>
|
||||||
|
> 目前还没有支持从自定义 url 导入。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 你知道吗
|
## 你知道吗
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
---
|
||||||
|
configurations:
|
||||||
|
prism.plugins: 'command-line'
|
||||||
|
---
|
||||||
|
|
||||||
# Web Server
|
# Web Server
|
||||||
|
|
||||||
[Apache]: https://httpd.apache.org/
|
[Apache]: https://httpd.apache.org/
|
||||||
@ -14,9 +19,17 @@ ph-Bookshelf 原始版本是在 [Apache Web Server][Apache] 环境下开发的
|
|||||||
|
|
||||||
确认 [mod_rewrite] 已经打开。这一般可以通过以下简单的命令确认:
|
确认 [mod_rewrite] 已经打开。这一般可以通过以下简单的命令确认:
|
||||||
|
|
||||||
```shell-session
|
<pre
|
||||||
# a2enmod rewrite
|
class="command-line"
|
||||||
```
|
data-user="root"
|
||||||
|
data-output="2-4, 6"
|
||||||
|
><code class="lang-bash"
|
||||||
|
>a2enmod rewrite
|
||||||
|
Enabling module rewrite.
|
||||||
|
To activate the new configuration, you need to run:
|
||||||
|
service apache2 restart
|
||||||
|
a2enmod rewrite
|
||||||
|
Module rewrite already enabled</code></pre>
|
||||||
|
|
||||||
> 如果你使用的是旧版 Apache<small>一般存在于会被叫做 httpd 的 apache</small>,module 配置或许会在服务器里,这时候,大概你的 Apache 的配置文件(通常为 `/etc/apache2/httpd.conf`{.lang-url} 或者 `/etc/httpd/httpd.conf`{.lang-url}),找到以下行并取消注释它:
|
> 如果你使用的是旧版 Apache<small>一般存在于会被叫做 httpd 的 apache</small>,module 配置或许会在服务器里,这时候,大概你的 Apache 的配置文件(通常为 `/etc/apache2/httpd.conf`{.lang-url} 或者 `/etc/httpd/httpd.conf`{.lang-url}),找到以下行并取消注释它:
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user