getherbie / plugin-smartypants
Herbie 的 Smartypants 插件。
v1.0.0
2016-04-05 15:03 UTC
Requires
- getherbie/herbie: ^1.0.0
This package is auto-updated.
Last update: 2024-09-29 00:21:02 UTC
README
Smartypants
是一个 Herbie 插件,通过 Michel Fortin 的 Smartypants 解析器对内容以及页面标题进行排版调整。
Smartypants 库负责以下转换
- 直排引号 (" 和 ') 转换为 "正确的" 引号
- 倒置的直排引号(如这些' '')转换为 "正确的" 引号
- 两个或三个短横线 (-- 和 ---) 转换为破折号和省略号
- 三个连续的点 (...) 转换为省略号
关于库及其选项的更多信息,请访问 https://github.com/michelf/php-smartypants。
安装
您可以通过 Composer 安装此插件。
$ composer require getherbie/plugin-smartypants
之后,在配置文件中激活插件。
plugins:
enable:
- smartypants
配置
在 plugins.config.smartypants
下,您有以下选项可用
# Add a twig filter
twig_filter: false
# Enable processing on page title
process_title: false
# Enable processing on page content
process_content: true
# Smartypants-specific configuration options
options: "qDew"
有关 Smartypants 可用选项的更多信息,请访问 https://github.com/michelf/php-smartypants#options-and-configuration。
页面属性
除了 twig_filter
之外,您可以覆盖页面的全局配置。
---
title: 'Meine "Seite"'
smartypants:
process_title: true
process_content: true
options: qd
---
页面属性优先于全局设置。
Twig 过滤器
如果启用 Twig 过滤器,您还可以在布局文件中使用 Smartypants
{{ page.title | smartypants }}
您还可以向过滤器提供自己的 Smartypants 选项
{{ page.title | smartypants('qew') }}