Skip to content

WebAssembly bindings for Outline (Literate programming tool)

Notifications You must be signed in to change notification settings

foxfriends/outline-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Outline JS

This package provides WebAssembly bindings to the Rust library Outline.

In particular, it exposes the built in parsers for use in a JavaScript context. For documentation on anything not specific to the WASM bindings, see the main Outline repo.

Installation

npm install --save @oinkiguana/outline

Example Usage

import { MdParser } from '@oinkiguana/outline';

const parser = new MdParser().set_fence_sequence('~~~');
const helloWorld = parser.tangle(`
# Hello world

Here we have the hello world:

~~~
==> Say hello.
~~~

This is how you say hello:

~~~ - Say hello
console.log('Hello world');
~~~
`);

eval(helloWorld); // should log 'Hello world'

Documentation

The package exports just the 4 parsers:

  • MdParser
  • HtmlParser
  • TexParser
  • BirdParser

Each follows a very similar API:

parser.tangle(source[, entrypoint[, language]])

  • Parses the source to produce the tangled (runnable code) output
  • entrypoint and language are passed along to Outline, and used to choose the entrypoint and language to compile
  • If there is an error, it will be thrown (as a string)

parser.weave(source)

  • Parses the source to produce the weaved documentation output
  • If there is an error, it will be thrown (as a string)

parser.set_<config_property>(value)

  • Sets the config property on the parser. See the Outline documentation for information on the options for each parser
  • Mutates and returns this for chaining

parser.<config_property>()

  • Retrieves the current value of the property

About

WebAssembly bindings for Outline (Literate programming tool)

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published