@flex-development/docmark-factory-markers
v1.0.0-alpha.22
Published
docmark factory to parse comment markers
Maintainers
Readme
docmark-factory-markers
docmark factory to parse comment markers.
Contents
What is this?
This package exposes states to parse comment markers.
When should I use this?
This package may be useful when making your own docmark extensions.
Install
This package is ESM only.
In Node.js with yarn:
yarn add @flex-development/docmark-factory-markersIn Deno with esm.sh:
import { factorMarkers } from 'https://esm.sh/@flex-development/docmark-factory-markers'In browsers with esm.sh:
<script type="module">
import { factoryMarkers } from 'https://esm.sh/@flex-development/docmark-factory-markers'
</script>Use
TODO: use
API
This package exports the identifier factoryMarkers.
There is no default export.
factoryMarkers(effects, ok, nok, markers)
Create a state that tokenizes a sequence of markers.
The returned state consumes each marker in markers in order.
Each marker produces a token using the specified token type, or tt.commentMarker by default.
If the input does not match the expected sequence, tokenization fails without consuming the mismatching character.
Parameters
effects(Effects) — the context object used to transition the state machineok(State) — the successful tokenization statenok(State) — the failed tokenization statemarkers(CodeCheck|Markers) — the marker matcher, info object, code, or sequence
Returns
(State) The initial state
Utilities
@flex-development/docmark-factory-markers/utils exports the identifier normalize.
There is no default export.
normalize(marker)
Normalize a marker configuration.
Parameters
marker(CodeCheck|Marker|MarkerInfo) — the marker matcher, info object, or code
Returns
(MarkerInfo) The marker info object
Types
This package is fully typed with TypeScript.
It exports no additional types.
Project
Version
docmark-factory-markers adheres to semver.
Contribute
See CONTRIBUTING.md.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.
Sponsor
Small primitives power larger systems. Support long-term stability by sponsoring Flex Development.
