0.0.11 • Published 2 years ago

dst-parser v0.0.11

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
2 years ago

Docstring Parser

The docstring parser for C-like (including C++, JavaScript, Rust) and Python-like syntax, where code that should be included in documentation is marked with custom comments.

Syntax

A piece of code is considered a named fragment when it is located between // BEGIN FRAGMENT: <name> and // END FRAGMENT, <> not included. This syntax is case-sensitive.

Don't use special characters in names; snakeCase is preferrable.

Fragments can be included in one another. In that case the lines matching // BEGIN FRAGMENT: <name> and // END FRAGMENT are removed.

Elements between // BEGIN ESCAPE and // END ESCAPE are excluded unconditionally from the tutorial.

Installation

Install the parser as a development dependency of your package:

npm install dst-parser --save-dev

Install the parser globally:

npm install dst-parser -g

Example code

import { ExampleParser } from "dst-parser"
let text = `
// BEGIN FRAGMENT: Test
This text is displayed
// BEGIN ESCAPE
OR IS IT?
// END ESCAPE
// END FRAGMENT
`
let parser_inst = new ExampleParser(text)
console.log(parser_inst.mapLines())
0.0.10

2 years ago

0.0.11

2 years ago

0.0.9

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.1

2 years ago