remarkjs / Remark Textr
Programming Languages
Labels
Projects that are alternatives of or similar to Remark Textr
remark-textr
remark plugin to make your typography better with Textr.
Install
npm:
npm install remark-textr
Use
Say we have the following file, example.md
:
## spread operator...
```js
function(...args) { return args; }
```
And our script, example.js
, looks as follows:
var vfile = require('to-vfile')
var remark = require('remark')
var textr = require('remark-textr')
remark()
.use(textr, {plugins: [ellipses]})
.process(vfile.readSync('example.md'), function(err, file) {
if (err) throw err
console.log(String(file))
})
// Textr plugin: just a function to replace triple dots to ellipses.
function ellipses(input) {
return input.replace(/\.{3}/gim, '…')
}
Yields:
## spread operator…
```js
function(...args) { return args; }
```
API
remark().use(textr[, config])
Make your typography better with Textr.
config
config.plugins
List of Textr plugins (Array.<string|Function>?
).
If strings are passed in, those are loaded with require
.
Textr plugins are available on npm, labelled with textr
keyword.
You can also create them yourself, as shown in the example above.
config.options
Textr options (Object?
).
For example, you may want to set the ISO 639 locale code of the
content, which is important for stuff like the correct primary and secondary
quotes.
Security
Use of remark-textr
does not involve rehype (hast)
or user content so there are no openings for cross-site scripting (XSS)
attacks.
Textr operates on text nodes, which are always escaped by remark.
Contribute
See contributing.md
in remarkjs/.github
for ways
to get started.
See support.md
for ways to get help.
This project has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.