Page
Library
Module
Module type
Parameter
Class
Class type
Source
An OCaml library and CLI tool to produce a single monolithic Markdown file by parsing with Cmarkit, detecting navigational TOC-like link lists, and recursively inlining referenced files.
opam install markdown_monolithFull API documentation is available at: https://durbatuluk1701.github.io/markdown_monolith/
The documentation includes:
You can also build the documentation locally:
dune build @doc
# View at _build/default/_doc/_html/markdown_monolith/index.htmlmarkdown_monolith input.md -o output.mdBasic inlining:
markdown_monolith main.md -o monolith.mdEnable remote fetching (use with caution):
markdown_monolith main.md --allow-remote -o output.mdControl recursion depth:
markdown_monolith main.md --max-depth 5 -o output.mdFor detailed API documentation, see https://durbatuluk1701.github.io/markdown_monolith/
open Markdown_monolith
(* Create custom configuration *)
let config = {
Monolith.default_config with
allow_remote = false; (* Keep remote fetching disabled for security *)
max_depth = 5; (* Limit recursion depth *)
dedupe = true; (* Prevent duplicate inlining *)
}
(* Process a file *)
match Monolith.monolith_of_file ~config "input.md" with
| Ok doc ->
let output = Cmarkit_commonmark.of_doc doc in
print_endline output
| Error msg ->
prerr_endline ("Error: " ^ msg)monolith_of_file: Main function to process a markdown file into a monolithic documentSee the full API documentation for complete details.
cmarkit: Modern CommonMark parser and renderercmdliner: CLI argument parsinglwt: Asynchronous I/Ocohttp-lwt-unix (>= 5.0): HTTP client for remote fetchinglwt_ssl (>= 1.2.0): SSL/TLS support for HTTPSSee LICENSE file.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
For bug reports and feature requests, please use the GitHub issue tracker.