package frontmatter_extractor

  1. Overview
  2. Docs
Front-matter extractor library

Install

dune-project
 Dependency

Authors

Maintainers

Sources

0.1.tar.gz
md5=b420d881d289e6e8f27adbcd02464f6e
sha512=ee9bc98c62304b409911f42a738d2f4c01db2492e91bf184812c9fd6c0ca28c9be061003416e44bf1e95345da3d864a0970ff84e299d1938ba79d0bd6121aeff

Description

Tags

front-matter front text

Published: 23 Dec 2025

README

frontmatter_extractor

The small utility library for extracting frontmatter section from text in OCaml.

Usage

# #require "frontmatter_extractor";;
let some_text = {|
---
title: "My First Blog Post"
data: 2025-12-1
---

Hello! It's just some text...
|};;

Extract frontmatter as plain text.

# Frontmatter_extractor.of_string some_text;;

- : Frontmatter_extractor.extracted =
{Frontmatter_extractor.matter =
  Some "\ntitle: \"My First Blog Post\"\ndata: 2025-12-1\n";
 body = "\n\nHello! It's just some text...\n"}

Extract the front matter as parsed YAML values. The yaml library needs to be installed.

# Frontmatter_extractor_yaml.of_string_exn some_text;;

- : Frontmatter_extractor_yaml.extracted =
{Frontmatter_extractor_yaml.attrs =
  Some
   (`O [("title", `String "My First Blog Post"); ("data", `String "2025-12-1")]);
 body = "\n\nHello! It's just some text...\n"}

Dependencies (2)

  1. ocaml
  2. dune >= "3.15"

Dev Dependencies (1)

  1. odoc with-doc

Used by

None

Conflicts

None