3.1.0 • Published 4 years ago

commonmark-wikiwords v3.1.0

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

WikiWords for commonmark.js CircleCIcodecov

This package offers an AST transformer for adding WikiWords syntax to CommonMark.

Usage

var commonmark = require("commonmark");
var wikiwords = require("commonmark-wikiwords");

var reader = new commonmark.Parser();
var writer = new commonmark.HtmlRenderer();

var parsed = reader.parse(src);
var transformed = wikiwords.transform(parsed);

var htmlSrc = writer.render(transformed);

WikiWord Syntax

This package has a looser definition of WikiWords.

In addition to FooBar and FooBarBaz, it supports FooBBar and FooB.

This follow the exact definition of WikiCase on C2 Wiki, which does not allow these. If strict compliance is useful, please file a bug.

To avoid forming wikiwords, C2 suggests embedding an empty string. You can do something similar in commonmark: Foo<!-- -->Bar.

Highlighting Nonexistent Links

You can also pass a callback to style links based on their name. This is useful for styling links that don't yet exist.

var commonmark = require("commonmark");
var wikiwords = require("commonmark-wikiwords");

var reader = new commonmark.Parser();
var writer = new commonmark.HtmlRenderer();

var parsed = reader.parse(src);
var transformed = wikiwords.transform(parsed, name =>
  name === "foo" ? "exciting-page" : null
);

var htmlSrc = writer.render(transformed);
3.1.0

4 years ago

3.0.0

4 years ago

2.4.0

4 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago