unified

Project: phuctm97/remark-unwrap-texts

Package: remark-unwrap-texts@1.0.3

  1. 📋 Unwraps text nodes in Markdown, is useful when publishing to platforms like DEV.to, Medium, Hashnode, etc.
  1. remark 213
  2. unified 180
  3. markdown 152
  4. plugin 136
  5. remark-plugin 81
  6. extension 9
  7. commonmark 6
  8. unified-plugin 6

📋 remark-unwrap-texts

npm version GitHub license

Unwraps text nodes in Markdown, is useful when publishing to platforms like DEV.to, Medium, Hashnode, etc. These platforms may not support text wraps and generate unexpected newlines.

Example

Before

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ultricies massa
ut nisl commodo lacinia. Phasellus convallis in urna eget pharetra. Quisque
pharetra, odio eget lobortis commodo, orci metus laoreet velit, eget finibus
orci ipsum laoreet mauris. In vel neque nec augue fringilla porta.

After

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ultricies massa ut nisl commodo lacinia. Phasellus convallis in urna eget pharetra. Quisque pharetra, odio eget lobortis commodo, orci metus laoreet velit, eget finibus orci ipsum laoreet mauris. In vel neque nec augue fringilla porta.

Usage

Install

yarn add remark-unwrap-texts

Configure

Unified / Remark:

unified()
  .use(require("remark-parse"))
  .use(require("remark-unwrap-texts"))
  .use(require("remark-stringify"));
remark().use(require("remark-unwrap-texts"));

MDX:

mdx(mdxText, {
  remarkPlugins: [require("remark-unwrap-texts")],
});

Made by @phuctm97.