Skip to content

coldnew/org2mdx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

org2mdx

CI

Convert between Org and MDX with a unist-compliant AST.

Installation

cargo build --release

Build & Test

cargo build --release          # build the binary
cargo test                     # run all tests
cargo test test_org_to_ast     # run a single test
cargo fmt                      # format code before committing

Usage

# Org -> MDX (default)
org2mdx input.org
org2mdx input.org -o output.mdx

# MDX -> Org
org2mdx input.mdx --from mdx --to org
org2mdx input.mdx --from mdx --to org -o output.org

# Org -> AST (JSON)
org2mdx input.org --to ast
org2mdx input.org --to ast -o ast.json

# MDX -> AST (JSON)
org2mdx input.mdx --from mdx --to ast
org2mdx input.mdx --from mdx --to ast -o ast.json

Options

Flag Default Description
--from org Input format: org or mdx
--to mdx Output format: mdx, org, or ast
-o stdout Output file path

AST output

The --to ast flag outputs the parsed syntax tree as pretty-printed JSON following the unist specification. Each node has a type field, optional children, value, data, and position properties.

Library API

// Org -> MDX
let mdx = org2mdx::org_to_mdx::convert(org_str)?;

// MDX -> Org
let org = org2mdx::mdx_to_org::convert(mdx_str)?;

// Parse to AST
let root = org2mdx::org_to_ast::parse(org_str)?;
let root = org2mdx::mdx_to_ast::parse(mdx_str)?;

About

convert org-mode to mdx file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors