Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ignore content display via HTML comments, Shown in GitHub readme, excluded in HTML.

License

NotificationsYou must be signed in to change notification settings

jaywcjlove/rehype-ignore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Buy me a coffeeDownloadsNPM versionBuildCoverage StatusRepo Dependents

Ignore content display via HTML comments, Shown in GitHub readme, excluded in HTML.

Installation

This package isESM only: Node 12+ is needed to use it and it must beimport instead ofrequire.

npm install rehype-ignore

Options

exportdeclaretypeRehypeIgnoreOptions={/**   *  Character to use for opening delimiter, by default `rehype:ignore:start`   */openDelimiter?:string;/**   * Character to use for closing delimiter, by default `rehype:ignore:end`   */closeDelimiter?:string;};

Usage

import{rehype}from'rehype';importrehypeIgnorefrom'rehype-ignore';rehype().data('settings',{fragment:true}).use(rehypeIgnore,{})

HTML Example

<h1>header</h1><p>  Hello<!--rehype:ignore:start--><code>World</code><!--rehype:ignore:end--></p>

Output:

<h1>header</h1><p>  Hello</p>
import{rehype}from'rehype';importrehypeIgnorefrom'rehype-ignore';consthtml=`<h1>header</h1><p>  Hello <!--rehype:ignore:start--> <code>World</code> <!--rehype:ignore:end--></p>`consthtmlStr=rehype().data('settings',{fragment:true}).use(rehypeAttrs,{properties:'attr'}).processSync(html).toString()

Markdown Example

#Hello World<!--rehype:ignore:start-->Hello World<!--rehype:ignore:end-->Good!

Output:

<h1>Hello World</h1><p>Good!</p>
import{unified}from'unified';importrehypeIgnorefrom'rehype-ignore';importremarkParsefrom'remark-parse';importremark2rehypefrom'remark-rehype';importrehypeRawfrom'rehype-raw';importstringifyfrom'rehype-stringify';consthtml=`# Hello World<!--rehype:ignore:start-->Hello World<!--rehype:ignore:end-->Good!`consthtmlStr=unified().use(remarkParse).use(remark2rehype,{allowDangerousHtml:true}).use(rehypeRaw).use(rehypeIgnore,{}).use(stringify).processSync(html).toString()

Related

Contributors

As always, thanks to our amazing contributors!

Made withaction-contributors.

License

MIT ©Kenny Wong

About

Ignore content display via HTML comments, Shown in GitHub readme, excluded in HTML.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp