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

uniorg-slug

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uniorg-slug

uniorg plugin to add `id` attributes to headlines

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
106
increased by2.91%
Maintainers
2
Weekly downloads
 
Created
Source

uniorg-slug

uniorg plugin to add anchors headings using GitHub's algorithm. Similar to rehype-slug but respects org-mode's CUSTOM_ID (as org-html-export).

Install

npm install uniorg-slug

Use

import { unified } from 'unified';
import uniorgParse from 'uniorg-parse';
import { uniorgSlug } from 'uniorg-slug';
import uniorg2rehype from 'uniorg-rehype';
import html from 'rehype-stringify';

const node = unified()
  .use(uniorgParse)
  .use(uniorgSlug)
  .use(uniorg2rehype)
  .use(html)
  .processSync(`
* headline
** nested headline
:PROPERTIES:
:CUSTOM_ID: blah
:END:
** headline
:PROPERTIES:
:ID: my-id
:END:
~id~ property is ignored.
`);

console.log(node.toString());

will output:

  <h1 id="headline">headline</h1>
  <h2 id="blah">nested headline</h2>
  <h2 id="headline-1">headline</h2>
  <p><code class="inline-code">id</code> property is ignored.</p>

License

GNU General Public License v3.0 or later

Keywords

FAQs

Package last updated on 29 Jan 2023

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