Skip to content

Replace a section in a Markdown file with different content

Notifications You must be signed in to change notification settings

pioneeronezero/markdown-replace-section

 
 

Repository files navigation

markdown-replace-section

Replace a section in a Markdown file with different content.

Installation

npm install --save markdown-replace-section

Usage

Code

import replaceSection from "markdown-replace-section";

const markdown =
`
Title
=====

Old content

Other title
===========

Some other content
`;

const hungry = true; // Set to false to keep the Subtitle section
console.log(replaceSection(markdown, "Title", "New content", hungry));

Output

Title
=====

New content

Other title
===========

Some other content

License

See LICENSE

About

Replace a section in a Markdown file with different content

Resources

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 84.7%
  • JavaScript 15.3%