1.1.1 • Published 6 months ago

uniorg-rehype v1.1.1

Weekly downloads
29
License
GPL-3.0-or-later
Repository
github
Last release
6 months ago

uniorg-rehype

uniorg plugin to mutate uniorg to rehype.

Note: uniorg-rehype doesn't deal with HTML inside the Org (#+begin_export html). You'll need rehype-raw if you're planning on doing that.

Install

npm install uniorg-rehype

Use

var unified = require('unified')
var createStream = require('unified-stream')
var uniorgParse = require('uniorg-parse')
var uniorg2rehype = require('uniorg-rehype')
var html = require('rehype-stringify')

var processor = unified().use(uniorgParse).use(uniorg2rehype).use(html)

process.stdin.pipe(createStream(processor)).pipe(process.stdout)

API

processor().use(uniorg2rehype[, options])

uniorg plugin to mutate to rehype.

orgToHast(uniorg[, options])

Convert uniorg AST into hast.

import { parse } from 'uniorg-parse/lib/parser';
import { orgToHast } from 'uniorg-rehype/lib/org-to-hast';

orgToHast(parse(`* headline`));

options

imageFilenameExtensions

Filename extensions that should be considered as images. This is used to decide whether a link should be rendered as an <a> or and <img>.

useSections

Whether to wrap all org sections into <section>. Defaults to false.

footnotesSection

Renderer function for footnotes. Roughly corresponds to org-html-footnotes-section.

handlers

Allow overriding rendering for any uniorg type. Each handler receives the node of the corresponding type and should return valid hast tree.

For example:

import { h } from 'hastscript';
const processor = unified()
  .use(uniorgParse)
  .use(uniorg2rehype, {
    handlers: {
      'comment': (org) => {
        return h('div.comment', [{ type: 'text', value: org.value }]);
      },
    },
  });

License

GNU General Public License v3.0 or later

1.1.1

6 months ago

1.0.0

1 year ago

1.1.0

1 year ago

0.5.9

1 year ago

0.5.8

1 year ago

0.5.7

1 year ago

0.5.6

1 year ago

0.5.5

2 years ago

0.5.4

2 years ago

0.5.3

2 years ago

0.5.2

2 years ago

0.5.0

2 years ago

0.5.1

2 years ago

0.4.8

2 years ago

0.4.7

3 years ago

0.4.6

3 years ago

0.4.5

3 years ago

0.4.4

3 years ago

0.4.3

3 years ago

0.4.0

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.3

3 years ago

0.2.1

3 years ago

0.2.2

3 years ago

0.1.23

3 years ago

0.1.24

3 years ago

0.1.25

3 years ago

0.2.0

3 years ago

0.1.21

3 years ago

0.1.18

3 years ago

0.1.19

3 years ago

0.1.17

3 years ago

0.1.16

3 years ago

0.1.15

3 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.4

3 years ago

0.1.5

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago