Skip to content

Repository files navigation

Docube

Docube is a libre content SDK that validates and transforms your any content into any format. By default, it converts text into type-safe JSON data that you can easily import into your application’s pages.

Quick start

Transform a folder of org files into type-safe JSON collections with a single call — no Effect or Layer boilerplate required.

import { transform } from "@docube/org";

await transform({
  name: "Post",
  directory: "posts",
  include: "**/*.org",
  fields: (s) => ({
    title: s.String,
    tags: s.Array(s.String),
  }),
  rehypePlugins: [/* ... */],
  contentTransform: (converted) => ({
    ...converted,
    tags: String(converted.tags).trim().split(" "),
  }),
});

The generated files land in .docube/generated/ by default. See each package’s README for format-specific usage.

Workflow

graph TD
    A[Loader] -->|Array of FileLike| B{Split Process}
    B -->|Optional| C[ModuleResolver]
    B -->|Main| D[FileConverter]
    D -->|FileLike| E[Writer]
    E --> F[End]

    subgraph "Per FileLike"
    D
    E
    end
Loading

Packages

docube
The core package which contains crucial class definitions.
common
Common implementations for transforming content into type-safe JSON.
markdown
Collects markdown documents and transforms them into JSON.
mdx
Collects MDX documents and transforms them into JSON.
org
Collects org-mode documents and transforms them into JSON.

About

Mirror of docube

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages