Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=780e6bb03f474a071eff8099862aaff5
sha512=d108fab9854ef32d23de532d66046511c202a1667106b20eb9339f82dec416c02f95589dc7183d5fcd44864cd53fd76c8a478639106e2e7e6523d2c526c7fbdb
Description
OCaml library and CLI to produce a single monolithic Markdown file by parsing with Cmarkit, detecting link lists, and recursively inlining referenced files. Supports local and remote (HTTP/HTTPS) sources with configurable depth limits and deduplication.
README
markdown_monolith
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.
Installation
opam install markdown_monolithDocumentation
Full API documentation is available at: https://durbatuluk1701.github.io/markdown_monolith/
The documentation includes:
- Comprehensive API reference for all modules and functions
- Detailed configuration options with examples
- Usage patterns and best practices
- Limitations and security considerations
You can also build the documentation locally:
dune build @doc
# View at _build/default/_doc/_html/markdown_monolith/index.htmlUsage
Basic Usage
markdown_monolith input.md -o output.mdExamples
Basic 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.mdLibrary API
For 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)Key Functions
monolith_of_file: Main function to process a markdown file into a monolithic document
See the full API documentation for complete details.
Dependencies
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 HTTPS
License
See LICENSE file.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
For bug reports and feature requests, please use the GitHub issue tracker.
Dependencies (7)
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building markdown_monolith with each compiler on check.ci.ocaml.org, run of against opam-repository 78c202b. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.1.1 (this version) | n/a | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure