pandoc-typescript: TypeScript type generation for Pandoc AST types

[ library, mit, text ] [ Propose Tags ] [ Report a vulnerability ]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Change log CHANGELOG.md
Dependencies aeson, aeson-typescript, base (>=4 && <5), pandoc-types, text [details]
License MIT
Author Sridhar Ratnakumar
Maintainer srid@srid.ca
Uploaded by sridca at 2026-02-02T01:15:31Z
Category Text
Home page https://github.com/srid/imako/tree/master/backend/pandoc-typescript
Distributions
Downloads 2 total (2 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for pandoc-typescript-0.1.0.0

[back to package description]

pandoc-typescript

TypeScript type generation for Pandoc AST types.

Overview

This package provides TypeScript instances for Pandoc's AST types (Block, Inline, Pandoc, etc.) using aeson-typescript.

JSON Format

Pandoc's native ToJSON uses short keys for efficiency:

  • "t" for tag (constructor name)
  • "c" for contents (constructor arguments)

For example, a paragraph block serializes as:

{"t": "Para", "c": [{"t": "Str", "c": "Hello"}]}

The generated TypeScript types match this format.

Usage

import Text.Pandoc.Definition.TypeScript (pandocTsDeclarations)
import Data.Aeson.TypeScript.TH (formatTSDeclarations)

main :: IO ()
main = putStrLn $ formatTSDeclarations pandocTsDeclarations

Generated Types

The types are currently generated to frontend/src/components/markdown/types.ts via the generate-types executable.

TODO: Encapsulate the generated TypeScript file within this package (perhaps as a build artifact or embedded resource).

Note

This package uses base (not Relude) to minimize dependencies.