strip-codeblocks

Crates.iostrip-codeblocks
lib.rsstrip-codeblocks
version0.1.0
created_at2025-12-01 03:06:17.726776+00
updated_at2025-12-01 03:06:17.726776+00
descriptionA Rust library to strip markdown code blocks from text, preserving only the inner content
homepage
repositoryhttps://github.com/fileng87/strip-codeblocks
max_upload_size
id1959224
size12,214
ZyraX (fileng87)

documentation

README

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

Commit count: 0

cargo fmt