All Projects → rasendubi → uniorg

rasendubi / uniorg

Licence: GPL-3.0 license
An accurate Org-mode parser

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
Nix
1067 projects

Projects that are alternatives of or similar to uniorg

Orgajs
parse org-mode content into AST
Stars: ✭ 417 (+119.47%)
Mutual labels:  unified, org-mode
lilt
LILT: noun, A characteristic rising and falling of the voice when speaking; a pleasant gentle accent.
Stars: ✭ 18 (-90.53%)
Mutual labels:  parse, parsers
Micromark
the smallest commonmark compliant markdown parser that exists; new basis for @unifiedjs (hundreds of projects w/ billions of downloads for dealing w/ content)
Stars: ✭ 793 (+317.37%)
Mutual labels:  parse, unified
go-oembed
Golang package for parsing Oembed data from known providers by URL
Stars: ✭ 22 (-88.42%)
Mutual labels:  parse
unified-args
Create CLIs for unified processors
Stars: ✭ 30 (-84.21%)
Mutual labels:  unified
go-htmlinfo
Go HTML Info package for extracting meaningful information from html page
Stars: ✭ 33 (-82.63%)
Mutual labels:  parse
BBob
⚡️Blazing-fast js-bbcode-parser, bbcode js, that transforms and parses to AST with plugin support in pure javascript, no dependencies
Stars: ✭ 133 (-30%)
Mutual labels:  parse
trio
Datatype agnostic triple store & query engine API
Stars: ✭ 78 (-58.95%)
Mutual labels:  org-mode
org-table-sticky-header
Sticky header for org-mode tables
Stars: ✭ 31 (-83.68%)
Mutual labels:  org-mode
my-emacs
My Emacs configuration
Stars: ✭ 35 (-81.58%)
Mutual labels:  org-mode
emacs-ob-racket
Emacs Org-Mode Babel code block Racket support
Stars: ✭ 22 (-88.42%)
Mutual labels:  org-mode
key-parsers
OCaml parsers for multiple key formats
Stars: ✭ 15 (-92.11%)
Mutual labels:  parsers
rehype-dom
HTML processor to parse and compile with browser APIs, powered by plugins
Stars: ✭ 20 (-89.47%)
Mutual labels:  unified
icecast-parser
Node.js module for getting and parsing metadata from SHOUTcast/Icecast radio streams
Stars: ✭ 66 (-65.26%)
Mutual labels:  parse
parsexiami
PHP解析虾米高品质音乐
Stars: ✭ 31 (-83.68%)
Mutual labels:  parse
org-recent-headings
Go to recently used Org headings
Stars: ✭ 47 (-75.26%)
Mutual labels:  org-mode
agenda
Org agenda in the console
Stars: ✭ 112 (-41.05%)
Mutual labels:  org-mode
dotfiles
My dotfiles - Emacs centric OSX Big Sur
Stars: ✭ 29 (-84.74%)
Mutual labels:  org-mode
dotfiles
I showed you my source code, pls respond
Stars: ✭ 45 (-76.32%)
Mutual labels:  org-mode
this-month-in-org
A monthly blog on developments with Org
Stars: ✭ 40 (-78.95%)
Mutual labels:  org-mode

uniorg

build codecov uniorg npm uniorg-parse npm uniorg-stringify npm uniorg-rehype npm uniorg-extract-keywords npm uniorg-attach npm uniorg-slug npm orgast-util-to-string npm orgast-util-visit-ids npm

uniorg is an accurate Org-mode parser compatible with unified ecosystem.

Why

I want to publish my braindump from org-mode notes. None of the parsers I tried have provided enough precision.

uniorg strives for parsing accuracy rather than speed or ease of writing the parser.

uniorg follows Org Syntax and Org Element API. It draws heavily from org-element.el, which means uniorg sees org files the same way as org-mode does. The code is full of regexes but that's exactly how org-mode parses files.

Though, there are a couple of intentional deviations from org-mode that make Uniorg more pleasant or easier to work with.

Demo

Status

uniorg successfully parses most of the org syntax. However, there are a couple of places I haven't finished yet:

  • inlinetask
  • babel-call, inline-babel-call, inline-src-block
  • dynamic-block
  • target, radio-target
  • line-break
  • export-snippet
  • macro
  • switches and parameters in src-block and example-block
  • repeater/warning props in timestamp

The rest of the syntax should work fine and exactly the same way as in Emacs (including complex list nesting, links, drawers, clock entries, latex, etc.). If you want to help with items above, grep parser.ts for TODO:.

Packages

This repository contains the following packages:

unified

uniorg is compatible with unified ecosystem, so you can take advantage of many existing plugins.

For example, here's how you transform an org-mode to html.

import { unified } from 'unified';
import parse from 'uniorg-parse';
import uniorg2rehype from 'uniorg-rehype';
import stringify from 'rehype-stringify';

const processor = unified().use(parse).use(uniorg2rehype).use(stringify);

processor
  .process(`* org-mode example\n your text goes here`)
  .then((file) => console.log(file.contents));

Plugins for code syntax highlight (rehype-highlight, @mapbox/rehype-prism) and latex-formatting (rehype-katex, rehype-mathjax) should work out of the box:

import { unified } from 'unified';
import parse from 'uniorg-parse';
import uniorg2rehype from 'uniorg-rehype';
import highlight from 'rehype-highlight';
import katex from 'rehype-katex';
import stringify from 'rehype-stringify';

const processor = unified()
  .use(parse)
  .use(uniorg2rehype)
  .use(highlight)
  .use(katex)
  .use(stringify);

processor
  .process(
    `* org-mode example
When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$

#+begin_src js
console.log('uniorg is cool!');
#+end_src
`
  )
  .then((file) => console.log(file.contents));

License

GNU General Public License v3.0 or later

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].