schema-markdown-doc

2.0.1 • Public • Published

schema-markdown-doc

npm GitHub

The schema-markdown-doc package generates documentation for Schema Markdown schemas.

Links

The Schema Markdown Documentation Component

The schemaMarkdownDoc function generates the element model for a Schema Markdown user type's documentation. For example:

import {parseSchemaMarkdown} from 'schema-markdown/lib/parser.js';
import {schemaMarkdownDoc} from 'schema-markdown-doc/lib/schemaMarkdownDoc.js';

const types = parseSchemaMarkdown(`\
# My struct
struct MyStruct

    # My member
    string member
`);
const elements = schemaMarkdownDoc(types, 'MyStruct');

The element model is rendered using element-model's renderElements function.

import {renderElements} from 'element-model/lib/elementModel.js';

renderElements(window.document.body, elements);

The Schema Markdown Documentation Viewer

To host your Schema Markdown type model's documentation, first, download the schema-markdown-doc application stub to the directory containing your type model's JSON:

curl -O https://craigahobbs.github.io/schema-markdown-doc/extra/index.html

By default, the schema-markdown-doc application stub displays documentation for "model.json". You can override the resource URL and specify a schema title by updating the schema-markdown-doc application stub, "index.html". For example:

~~~ markdown-script
include 'https://craigahobbs.github.io/schema-markdown-doc/doc/app.bare'

schemaMarkdownDoc('myModel.json', 'My Model')
~~~

To host locally, start a local static web server:

python3 -m http.server

You can also override the resource URL by adding the "var.vURL" hash parameter (i.e., "#var.vURL='myModel.json'").

Development

This package is developed using javascript-build. It was started using javascript-template as follows:

template-specialize javascript-template/template/ schema-markdown-doc/ -k package schema-markdown-doc -k name 'Craig A. Hobbs' -k email 'craigahobbs@gmail.com' -k github 'craigahobbs' -k noapp 1

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.178latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.178
2.0.05
1.9.01
1.8.01
1.7.01
1.6.31
1.6.21
1.6.11
1.6.01
1.5.61
1.5.51
1.5.41
1.5.31
1.5.22
1.5.11
1.5.01
1.4.61
1.4.51
1.4.41
1.4.31
1.4.22
1.4.12
1.4.01
1.3.01
1.2.31
1.2.21
1.2.11
1.2.01
1.1.01
1.0.82
1.0.71
1.0.61
1.0.51
1.0.41
1.0.31
1.0.21
1.0.11
1.0.01
0.9.121
0.9.111
0.9.101
0.9.91
0.9.81
0.9.71
0.9.62
0.9.51
0.9.41
0.9.31
0.9.21
0.9.12

Package Sidebar

Install

npm i schema-markdown-doc

Weekly Downloads

137

Version

2.0.1

License

MIT

Unpacked Size

19.6 kB

Total Files

4

Last publish

Collaborators

  • craigahobbs