Skip to content

vwkd/rehype-unwrap-spaces

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

Rehype plugin that unwraps leading and trailing spaces from inline nodes

Features

  • unwraps leading and trailing spaces from inline nodes
  • inline nodes currently used: <em>, <strong>, <a>

Example

import { unified, rehypeParse, rehypeStringify } from "./deps.ts";
import rehypeUnwrapSpaces from "./src/main.ts";

const result = (await unified()
  .use(rehypeParse, { fragment: true })
  .use(rehypeUnwrapSpaces)
  .use(rehypeStringify)
  .process(`<strong>foo </strong>bar`))
  .toString();
console.log(result);

Before

<strong>foo </strong>bar

After

<strong>foo</strong> bar

About

Rehype plugin that unwraps leading and trailing spaces from inline nodes

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published