API reference
Every exported provider, component, directive and function.
Every public export, by package.
@blasdoc/core
Parsing
import { parseBlasdoc, createBlasdocParser, BlasdocParserCache } from '@blasdoc/core';
parseBlasdoc(markdown, options?); // one-shot
createBlasdocParser(options?); // reusable
new BlasdocParserCache(parser, { limit? });BlasdocParseResult carries document, source, diagnostics, frontmatter
and settings.
Parse options
| Option | Meaning |
|---|---|
isComponentName(name) | decides which tags are components; default is "contains a dash" |
htmlPolicy | the allow-list of tags and attributes |
The IR
import type {
BlasdocNode, BlasdocDocumentNode, BlasdocComponentNode,
BlasdocElementNode, BlasdocHeadingNode, BlasdocPosition,
} from '@blasdoc/core';A component node keeps the four channels apart: attributes, bindings,
events, twoWayBindings, each entry carrying rawName, quote and a
cross-channel order.
Outline
import { blasdocHeadings, blasdocSlug, blasdocText } from '@blasdoc/core';Source
import {
sliceSource, sliceChildrenSource,
renderAngularSource, renderMarkdownSource,
} from '@blasdoc/core';Expressions
import { parseExpression, evaluateExpression } from '@blasdoc/core';Build (@blasdoc/core/build)
import {
blasdoc, // the Vite/Rollup plugin
transformAngularPage,
editorAngularPage,
installAngularPageTransform,
} from '@blasdoc/core/build';@blasdoc/angular
Providers
provideBlasdoc({ components?, context?, parseOptions? });
provideBlasdocHydration();Pages
import {
BlasdocPage, // the base class
blasdocPage, // the configured base class
blasdocPageInit, // emitted by the build transform
blasdocPageDiagnostics,
blasdocPageHeadings,
} from '@blasdoc/angular';Rendering a string
<blasdoc-content [source]="markdown" [context]="ctx" (diagnostics)="…" />import { BlasdocContentComponent, BlasdocDocumentComponent, BlasdocRenderer } from '@blasdoc/angular';Registry
import { BlasdocComponentRegistry, BLASDOC_COMPONENTS, normaliseComponents } from '@blasdoc/angular';Tokens
| Token | Gives |
|---|---|
BLASDOC_NODE | the IR node a component was created from |
BLASDOC_DOCUMENT_CONTEXT | the document's context, report and refresh channels |
BLASDOC_CODE_BLOCK_COMPONENT | the component every fence renders as |
BLASDOC_CONTEXT | the application-wide expression context |
BLASDOC_PARSE_OPTIONS | the application-wide parser options |
@blasdoc/highlight
provideBlasdocHighlight({ themes, defaultTheme?, ensureContrast? });import { BlasdocHighlighter } from '@blasdoc/highlight';
highlighter.peek(request); // what to show now, without waiting
highlighter.highlight(request); // the highlighted IR
highlighter.themeNames();@blasdoc/components
import {
BlasdocCodeBlockState,
BlasdocCodeBlock, BlasdocTabList, BlasdocTab,
BlasdocTabPanel, BlasdocCopy, BlasdocMode,
codeNodesToTabs, readThemeOverride,
} from '@blasdoc/components';@blasdoc/theme-default
provideBlasdocTheme();import { BlasdocContentStyles } from '@blasdoc/theme-default';@blasdoc/build
Angular builders, used from angular.json or project.json:
@blasdoc/build:application
@blasdoc/build:dev-serverAnd a TypeScript language-service plugin, used from tsconfig.json:
{ "compilerOptions": { "plugins": [{ "name": "@blasdoc/build" }] } }