5 releases (3 stable)

2.0.0 Jan 16, 2022
1.1.0 Apr 24, 2020
1.0.0 Jan 30, 2020
0.1.1 Jan 23, 2020
0.1.0-alpha Jan 22, 2020

#715 in Text processing

Download history 4/week @ 2024-01-01 26/week @ 2024-01-08 16/week @ 2024-01-15 14/week @ 2024-01-22 7/week @ 2024-01-29 10/week @ 2024-02-05 44/week @ 2024-02-12 30/week @ 2024-02-19 83/week @ 2024-02-26 51/week @ 2024-03-04 42/week @ 2024-03-11 45/week @ 2024-03-18 12/week @ 2024-03-25 89/week @ 2024-04-01 29/week @ 2024-04-08 29/week @ 2024-04-15

165 downloads per month
Used in 4 crates (via agpm_suggestions)

MIT license

10KB
189 lines

Markdown Extract

Crates.io Docker Pulls Build & Test

Extract sections of a markdown file with a regular expression! Great for changelogs ;)

Usage

Given a document called my-document.md:

# Welcome

This is my amazing markdown document.

## Extract me!

This section should be pulled out.

You can extract the second section with the following command:

$ markdown-extract "Extract me!" my-document.md
## Extract me!

This section should be pulled out.

Installation

If you've got Rust installed on your system, you can simply install markdown-extract with Cargo.

$ cargo install markdown-extract

Docker

A Docker image is also available, and can be installed with the following command:

$ docker pull sean0x42/markdown-extract:v2

You can then run the container with the following command:

$ docker run -it sean0x42/markdown-extract:v2 --help

Note that because markdown-extract accesses the file system, you will need to mount a volume if you want to access a file on the host. e.g.

$ docker run -v $PWD:/opt -it sean0x42/markdown-extract:v2 v2.0.0 /opt/CHANGELOG.md

If you know a better way of achieving this, please let me know!

Use Cases

There aren't many, to be honest.

  1. Extract patch notes from a CHANGELOG.md by version.
  2. The talented folks at HashiCorp are using markdown-extract to extract API documentation, and inject it into OpenAPI schemas.

If you have another use for this tool, please let me know!

Dependencies

~4–5.5MB
~102K SLoC