unified

Project: phuctm97/remark-unwrap-texts

Package: remark-unwrap-texts@1.0.3

  1. Dependencies: 1ยทDependents: 0
  2. ๐Ÿ“‹ Unwraps text nodes in Markdown, is useful when publishing to platforms like DEV.to, Medium, Hashnode, etc.
  1. remark 195
  2. unified 167
  3. markdown 135
  4. plugin 130
  5. remark-plugin 74
  6. extension 8
  7. commonmark 5
  8. unified-plugin 5

๐Ÿ“‹ 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.