0.0.6-mm • Published 1 year ago

micromark-extension-caml v0.0.6-mm

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
1 year ago

micromark-extension-caml

A WikiBonsai Project NPM package

A micromark syntax extension for CAML attributes, providing the low-level modules for integrating with the micromark tokenizer and the micromark HTML compiler.

You probably shouldn’t use this package directly, but instead use mdast-util-caml with mdast or remark-caml with remark.

Note that this extension only parses the input -- it is up to you to track and store attribute metadata.

🕸 Weave a semantic web in your 🎋 WikiBonsai digital garden.

Install

This package is ESM only. Install micromark-extension-caml on npm.

npm install micromark-extension-caml 

Usage

import micromark from 'micromark';
import { syntaxCaml, htmlCaml } from 'micromark-extension-caml';

let serialized = micromark(':attrtype::value\n', {
    extensions: [syntaxCaml()],
    htmlExtensions: [htmlCaml()]
});

The serialized result will be the following. To get an abstract syntax tree, use mdast-util-caml instead.

While data is extracted and stored in data tokens, no HTML is generated at the micromark level. To render directly to html, use mdast-util-caml.

Options

let opts = {
  attrs: {
    render: boolean;
    title: string;
  },
  css: {
    attr: string;
    attrbox: string;
    attrboxTitle: string;
    // [[wikilinks]]-related
    invalid: string;
    valid: string;
  },
};

Syntax

For more on syntax specification, see the caml repo.

Options Descriptions

See remark-caml readme for option descriptions.