Skip to main content
Version: 3.x.x 🚧


Npm VersionNpm DownloadNpm LicenseModule formats: cjs, esmNode.js VersionTested with JestCode Style: prettier

github flavor markdown spec

A line consisting of 030-3 spaces of indentation, followed by a sequence of three or more matching -, _, or * characters, each followed optionally by any number of spaces or tabs, forms a thematic break.


npm install --save @yozora/tokenizer-thematic-break



@yozora/tokenizer-thematic-break has been integrated into @yozora/parser / @yozora/parser-gfm-ex / @yozora/parser-gfm, so you can use YozoraParser / GfmExParser / GfmParser directly.

import YozoraParser from '@yozora/parser'

const parser = new YozoraParser()

// parse source markdown content


  • name: The unique name of the tokenizer, used to bind the token it generates, to determine the tokenizer that should be called in each life cycle of the token in the entire matching / parsing phase.

  • priority: Priority of the tokenizer, determine the order of processing, high priority priority execution. interruptable. In addition, in the match-block stage, a high-priority tokenizer can interrupt the matching process of a low-priority tokenizer.


@yozora/tokenizer-thematic-break produce ThematicBreak type nodes. See @yozora/ast for full base types.

import type { Node } from '@yozora/ast'

export const ThematicBreakType = 'thematicBreak'
export type ThematicBreakType = typeof ThematicBreakType

* ThematicBreak represents a thematic break, such as a scene change in
* a story, a transition to another topic, or a new document.
* @see
* @see
export type ThematicBreak = Node<ThematicBreakType>

Live Examples

  • Basic.

  • Wrong characters.

  • Not enough characters.

  • One to three spaces indent are allowed.

  • Four spaces is too many

  • More than three characters may be used.

  • Spaces are allowed between the characters.

  • Spaces are allowed at the end.

  • However, no other characters may occur in the line.

  • It is required that all of the non-whitespace characters be the same. So, this is not a thematic break.

  • Thematic breaks do not need blank lines before or after.

  • If a line of dashes that meets the above conditions for being a thematic break could also be interpreted as the underline of a setext heading, the interpretation as a setext heading takes precedence. Thus, for example, this is a setext heading, not a paragraph followed by a thematic break.

  • When both a thematic break and a list item are possible interpretations of a line, the thematic break takes precedence.

  • If you want a thematic break in a list item, use a different bullet.