Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uniorg-rehype

Package Overview
Dependencies
Maintainers
2
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uniorg-rehype

uniorg plugin to transform to rehype

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

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

Keywords

FAQs

Package last updated on 19 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc