strip-codeblocks 0.1.0

A Rust library to strip markdown code blocks from text, preserving only the inner content
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented2 out of 2 items with examples
  • Size
  • Source code size: 11.72 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.4 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 31s Average build duration of successful builds.
  • all releases: 31s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • fileng87/strip-codeblocks
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • fileng87

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