用于网页排版的HTML预处理器
Typeset 是一个用于网页排版的 HTML 预处理器,它提供了传统精细印刷中使用的排版功能,而这些功能在浏览器布局引擎中仍然无法实现。Typeset 的处理为您的网页带来以下特性:
$ npm i typesetconst typeset = require('typeset');
let html = '<p>"Hello," said the fox.</p>';
let output = typeset(html);然后调整CSS以匹配你字体的度量,并将其包含在你的页面中。
…你可以传入一个选项对象来影响 HTML 的排版方式:
const options = {
ignore: '.skip, #anything, .which-matches', // string of CSS selector(s) to ignore
only: '#only-typeset, .these-elements', // string of CSS selector(s) to exclusively apply typeset to
disable: ['hyphenate'] // array of typeset feature(s) to disable
};以下功能可能已被禁用:
hyphenatehangingPunctuation连字punctuation引号smallCapsspaces$ npm i -g typeset用法:typeset-js [选项] [<输入文件> [<输出文件>]]
Options:
-h, --help 输出使用信息
-V, --version 输出版本号
-i, --ignore 要忽略的CSS选择器字符串
-O, --only 仅应用于排版的CSS选择器字符串
--disable, string of typeset feature(s) to dis暂无开放 Issues,或尚未同步最近议题。