Skip to content

A Rust library to strip markdown fenced code blocks from text while preserving the inner content and leaving inline code blocks untouched.

License

Notifications You must be signed in to change notification settings

fileng87/strip-codeblocks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

strip-codeblocks

A Rust library to strip markdown fenced code blocks from text while preserving the inner content and leaving inline code blocks untouched.

Installation

Add this to your Cargo.toml:

[dependencies]
strip-codeblocks = "0.1.0"

Usage

use strip_codeblocks::strip_codeblocks;

let markdown = "Some text.\n\n```rust\nfn main() {}\n```\n\nMore text with `inline code`.";

let result = strip_codeblocks(markdown);
// Result: "Some text.\n\nfn main() {}\n\nMore text with `inline code`."

Features

  • Removes fenced code blocks (triple backticks: ```)
  • Preserves the content inside code blocks
  • Keeps inline code blocks (single backticks: `) intact
  • Handles code blocks with or without language identifiers

License

MIT - see LICENSE file for details

About

A Rust library to strip markdown fenced code blocks from text while preserving the inner content and leaving inline code blocks untouched.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages