submark (hackage):   [Index] [Quick Jump]  Static link  Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info  Package maintainers  For package maintainers and hackage trustees  Candidates         submark is a CLI program (and GitHub action) to extract some particular section from a given CommonMark/Markdown document.  I use it for myself to extract the latest version section from the CHANGELOG.md file, and then reuse the text for the corresponding release note on GitHub releases, during automated release process which is run on CI/CD.  Although it's a standalone CLI program, you can use it through a handy GitHub action dahlia/submark:  First of all, if you need to manually invoke submark on GitHub Actions, dahlia/submark/setup action is the easiest way to install it.  On the other CI/CD products, use the officially distributed executables. Prebuilt binaries for the following platforms and architectures are available on GitHub releases:  For other platforms and architectures, you need to build it by yourself. It's written in Haskell, so you need to install Haskell Stack first. It can be built in the same way other Haskell programs are:  The following examples use John Gruber's original Markdown introduction:  Extracting an H3 heading Command-Line:  Note that its textual style differ from the original text. Since submark internally builds an abstract syntax tree from the given input text and then render again the result tree, it doesn't maintain trivial styles (e.g., whitespaces, ATX vs. Setext headings) but only the semantics.  There are options from --h1 to --h6:  Options from --h1-regex to --h6-regex take a regular expression instead of an exact heading text:  The leading heading can be omitted:  Matching is case sensitive by default, but case can be ignored using the option -i/--ignore-case:  By Unix convention, - means pipe:  There's -o/--out-file option as well:  This software is distributed under GPL 3.
Keywords: gpl|library|program|text|commonmark|markdown