API / @aionbuilders/nabu/extend

MarkdownRule

Type Stability: stable

detect: does the block start at this line. consume: how many lines it takes from index (at least 1). priority: higher is tried first. interruptsParagraph: the block may start in the middle of a paragraph (a fence, a heading, a quote...); true means "whenever detect matches".

Definition

TypeScript
import type { MarkdownRule } from '@aionbuilders/nabu/extend';
TypeScript
type MarkdownRule = {
  consume: (lines: string[], index: number, helpers: MarkdownHelpers) => number;
  detect: RegExp | ((line: string, lines: string[], index: number, helpers: MarkdownHelpers) => boolean);
  interruptsParagraph?: boolean | ((line: string, lines: string[], index: number, helpers: MarkdownHelpers) => boolean);
  priority?: number;
  [field: string]: any;
}

Properties

Properties of MarkdownRule
PropertyTypeDescription
consume(lines: string[], index: number, helpers: MarkdownHelpers) => numbern/a
detectRegExp | ((line: string, lines: string[], index: number, helpers: MarkdownHelpers) => boolean)n/a
interruptsParagraphoptionalboolean | ((line: string, lines: string[], index: number, helpers: MarkdownHelpers) => boolean)n/a
priorityoptionalnumbern/a

Source: src/lib/utils/extensions.js:94