Detalhes do pacote

@mavrin/remark-typograf

Mavrin787MIT2.2.0

Plugin for remark to make your typography better with typograf

unified, remark, remark-plugin, plugin

readme (leia-me)

remarkjs-typograf

Plugin for remark to make your typography better with typograf

Example https://mavrin.github.io/remark-typograf/

Install

npm:

npm install @mavrin/remark-typograf remark

Use

Say we have the following file, example.md:

## spread operator `...`

It is test...

```js
function test(...args) {
  return args;
}
```

You probably want to use it on the CLI through a config file:

  …
  "remarkConfig": {
    "plugins": [
      [
        "@mavrin/remark-typograf",
        {
          "locale": ["ru"]
        }
      ]
    ]
  }
…

Or use it on the CLI directly (ru locale will be used as default)

remark -u @mavrin/remark-typograf example.md -o processed-example.md

Or use this on the API:

const fs = require("fs");
const path = require("path");
const remark = require("remark");
const remarkTypograf = require("@mavrin/remark-typograf");

const processed = remark()
  .use(remarkTypograf, { locale: ["en-US"], keywords: [":)"] })
  .processSync(fs.readFileSync(path.resolve(__dirname, "example.md")));

fs.writeFileSync(path.resolve(__dirname, "processed-example.md"), processed);

or with custom typograf:

const fs = require("fs");
const path = require("path");
const remark = require("remark");
const remarkTypograf = require("@mavrin/remark-typograf");
const Typograf = require("typograf");

const processed = remark()
  .use(remarkTypograf, {
    typograf: new Typograf({ locale: ["en-US"] }),
    keywords: [":)"],
    builtIn: false,
  })
  .processSync(fs.readFileSync(path.resolve(__dirname, "example.md")));

fs.writeFileSync(path.resolve(__dirname, "processed-example.md"), processed);

Yields:

## spread operator `...`

It is test…

```js
function test(...args) {
  return args;
}
```

Example source code

changelog (log de mudanças)

2.2.0 (Apr 10, 2021)

  • fix case when inline code link lead after the comma
  • add support remark@13
  • update dependencies

2.1.6 (May 5, 2020)

update dev dependencies

2.1.5 (May 5, 2020)

fix case with inline code

2.1.4 (May 5, 2020)

use visit method instead of own tree walker

2.1.3 (May 5, 2020)

use files section in package.json instead of .npmignore

2.1.2 (May 5, 2020)

Fix case with mark and punctuation. Before the fix, plugin add an unnecessary comma.

    **Categories,** а у родительского тега // original markdonw
    **Categories,**, а у родительского тега // before the fix
    **Categories,** а у родительского тега // after the fix

2.1.1 (Apr 26, 2020)

Fix readme

2.1.0 (Apr 26, 2020)

Add keywords config. Strings from this config will be not typografed.

2.0.1 (Apr 24, 2020)

Now typograf is built-in to plugin. Also was added remark-cli support.

Breaking Changes

Plugin use builtIn typograf. If you want use custom typograf set builtInoption to false.

1.0.0 (Apr 20, 2020)

Initial version.