package markdown_monolith

  1. Overview
  2. Docs
Produce a single monolithic Markdown file by inlining linked files

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1.1.tar.gz
md5=780e6bb03f474a071eff8099862aaff5
sha512=d108fab9854ef32d23de532d66046511c202a1667106b20eb9339f82dec416c02f95589dc7183d5fcd44864cd53fd76c8a478639106e2e7e6523d2c526c7fbdb

doc/markdown_monolith.fetch/Fetch/index.html

Module FetchSource

URI Fetching

This module provides functions to fetch content from URIs, supporting both local file paths and remote HTTP/HTTPS URLs.

  • since 0.1.0

Local File Fetching

Sourceval fetch_local_uri : Uri.t -> (string, string) result

fetch_local_uri uri reads the content of a local file.

  • parameter uri

    A URI with a file:// scheme or no scheme (treated as a local path)

  • returns

    Ok content with the file contents as a string, or Error msg if the file cannot be read

  • since 0.1.0

Remote and Local Fetching

Sourceval fetch_uri_lwt : ?debug:bool -> allow_remote:bool -> Uri.t -> (string, string) result Lwt.t

fetch_uri_lwt ?debug ~allow_remote uri asynchronously fetches content from a URI.

Supports the following URI schemes:

  • No scheme: Treated as a local file path
  • file://: Local file access
  • http:// and https://: Remote HTTP fetching (requires allow_remote = true)
  • parameter debug

    If true, print debug information to stdout (default: false)

  • parameter allow_remote

    If true, permit fetching from HTTP/HTTPS URLs. If false, remote URLs return an error.

  • parameter uri

    The URI to fetch content from

  • returns

    An Lwt promise resolving to Ok content or Error msg

Note: Remote fetches have no built-in timeout. Consider using Lwt.pick with Lwt_unix.timeout for timeout control.

  • since 0.1.0
Sourceval fetch_uri_sync : ?debug:bool -> allow_remote:bool -> Uri.t -> (string, string) result

fetch_uri_sync ?debug ~allow_remote uri synchronously fetches content from a URI.

This is a blocking wrapper around fetch_uri_lwt that runs the Lwt event loop until the fetch completes.

  • parameter debug

    If true, print debug information to stdout (default: false)

  • parameter allow_remote

    If true, permit fetching from HTTP/HTTPS URLs

  • parameter uri

    The URI to fetch content from

  • returns

    Ok content with the fetched content, or Error msg on failure

Warning: This function blocks the current thread. For concurrent fetching, use fetch_uri_lwt directly.

  • since 0.1.0