Skip to main content
Module

x/dendron_exports/deps/micromark.ts>TokenizeContext

Export your Dendron vault into SSG compatible markdown
Latest
interface TokenizeContext
import { type TokenizeContext } from "https://deno.land/x/dendron_exports@v0.2.2/deps/micromark.ts";

A context object that helps w/ tokenizing markdown constructs.

Properties

previous: Code

The previous code.

code: Code

Current code.

optional
interrupt: boolean | undefined

Whether we’re currently interrupting.

Take for example:

a
# b

At 2:1, we’re “interrupting”.

optional
currentConstruct: Construct | undefined

The current construct.

Constructs that are not partial are set here.

optional
containerState: ContainerState | undefined

share state set when parsing containers.

Containers are parsed in separate phases: their first line (tokenize), continued lines (continuation.tokenize), and finally exit. This record can be used to store some information between these hooks.

events: Array<Event>

Current list of events.

parser: ParseContext

The relevant parsing context.

sliceStream: (token: Pick<Token, "end" | "start">) => Array<Chunk>

Get the chunks that span a token (or location).

sliceSerialize: (token: Pick<Token, "end" | "start">, expandTabs?: boolean | undefined) => string

Get the source text that spans a token (or location).

now: () => Point

Get the current place.

defineSkip: (point: Point) => void

Define a skip

As containers (block quotes, lists), “nibble” a prefix from the margins, where a line starts after that prefix is defined here. When the tokenizers moves after consuming a line ending corresponding to the line number in the given point, the tokenizer shifts past the prefix based on the column in the shifted point.

write: (slice: Array<Chunk>) => Array<Event>

Write a slice of chunks.

The eof code (null) can be used to signal the end of the stream.

optional
_gfmTasklistFirstContentOfListItem: boolean | undefined

Internal boolean shared with micromark-extension-gfm-task-list-item to signal whether the tokenizer is tokenizing the first content of a list item construct.

optional
_gfmTableDynamicInterruptHack: boolean

Internal boolean shared with micromark-extension-gfm-table whose body rows are not affected by normal interruption rules. “Normal” rules are, for example, that an empty list item can’t interrupt:

a
*

The above is one paragraph. These rules don’t apply to table body rows:

| a |
| - |
*

The above list interrupts the table.