@lsdocs/rst #
interface Span #
Byte offsets in the parsed text: start inclusive, end exclusive.
property start #
start: numberproperty end #
end: numbertype alias AttrValue #
An attribute value.
interface Element #
An element: a docutils node kind ("paragraph", "section", ...).
property kind #
kind: stringproperty attributes #
attributes?: Record<string, AttrValue>property children #
children?: Nodeproperty span #
span?: Spaninterface Text #
Text in the tree.
property text #
text: stringproperty span #
span?: Spantype alias Node #
interface Settings #
The docutils settings the parser honors, by their docutils names.
property doctitle_xform #
doctitle_xform?: booleanproperty docinfo_xform #
docinfo_xform?: booleanproperty sectsubtitle_xform #
sectsubtitle_xform?: booleanproperty sectnum_xform #
sectnum_xform?: booleanproperty title #
title?: string | nullproperty tab_width #
tab_width?: numberproperty line_length_limit #
line_length_limit?: numberproperty raw_enabled #
raw_enabled?: booleanproperty pep_references #
pep_references?: booleanproperty pep_base_url #
pep_base_url?: stringproperty pep_file_url_template #
pep_file_url_template?: stringproperty rfc_references #
rfc_references?: booleanproperty rfc_base_url #
rfc_base_url?: stringproperty trim_footnote_reference_space #
trim_footnote_reference_space?: booleanproperty toc_backlinks #
toc_backlinks?: 'entry' | 'top' | 'none'property id_prefix #
id_prefix?: stringproperty auto_id_prefix #
auto_id_prefix?: stringproperty strip_comments #
strip_comments?: booleanproperty task_lists #
task_lists?: booleanTask lists (- [ ] item, - [x] item); not a docutils setting. Off by default.
type alias OptionKind #
docutils' option conversion functions, by name.
type alias OptionValue #
A converted option value: null for flags.
interface DirectiveContext #
What a directive's run gets.
property name #
readonly name: stringThe directive name as written.
property arguments #
readonly arguments: stringproperty options #
readonly options: Record<string, OptionValue>property content #
readonly content: stringThe content lines, indentation removed.
property lineno #
readonly lineno: numberThe line number of the directive's first line.
property blockText #
readonly blockText: stringproperty span #
readonly span?: Spanproperty inSubstitution #
readonly inSubstitution: booleanmethod parseContent #
container: Element: ElementParses the content as body elements into container.
method parseInline #
text: string:Parses text as inline markup: the nodes, and messages to put after their element.
method message #
level: number, text: string: ElementA system message (1 info to 4 severe) for the directive's line.
interface Directive #
A directive: what it accepts, and run.
property requiredArguments #
requiredArguments?: numberproperty optionalArguments #
optionalArguments?: numberproperty finalArgumentWhitespace #
finalArgumentWhitespace?: booleanproperty optionSpec #
optionSpec?: Record<string, OptionKind | string>Option names to conversion functions, or to lists of choices.
property hasContent #
hasContent?: booleanmethod run #
ctx: DirectiveContext: Array<Node | string>The directive's nodes; throw a DirectiveError to report a problem instead.
interface RoleContext #
What a role function gets.
property name #
readonly name: stringproperty text #
readonly text: stringThe text, escapes removed.
property rawText #
readonly rawText: stringThe text with its backslashes, as written.
property rawsource #
readonly rawsource: stringThe whole interpreted text as written, role included.
property options #
readonly options: Record<string, OptionValue>Options from the role directive that made the role.
property lineno #
readonly lineno: numberproperty span #
readonly span?: Spantype alias RoleFunction #
type alias Loader #
Reads a file or URL: bytes, or a string (taken as UTF-8). Throw a Node.js
system error (code such as ENOENT) for a failed read.
interface ParserOptions #
property source #
source?: stringThe document's name, used in messages.
property transforms #
transforms?: booleanApply docutils' transforms, as publish_doctree does.
property keepUnknownDirectives #
keepUnknownDirectives?: booleanKeep unknown directives as directive elements instead of reporting them.
property settings #
settings?: Settingsproperty directives #
directives?: Record<string, Directive>Directives by name, before any standard one of that name.
property roles #
roles?: Record<string, RoleFunction>Role functions by name.
property root #
root?: stringLet directives read files below this directory.
property files #
files?: LoaderOr read files with this function.
property urls #
urls?: LoaderAnd URLs with this one.
interface ParseResult #
property document #
document: Elementproperty messages #
messages: ElementMessages docutils' transforms report outside the tree.
class DirectiveError #
Thrown by a directive or role: reported in the document as a system message.
constructor constructor #
message: string, level?: numberfield level #
readonly level: numberclass Parser #
constructor constructor #
options?: ParserOptionsfield settings #
readonly settings: Required<Settings>The docutils settings in use.
method parse #
text: string: ElementParses text into a document element. Throws only when a JS
directive, role or loader throws (other than DirectiveError and
system errors).
method parseWithMessages #
text: string: ParseResultconstant INFO #
constant WARNING #
constant ERROR #
constant SEVERE #
function parse #
function parseWithMessages #
function pformat #
Pseudo-XML, exactly as docutils' pformat() prints it.
function toXml #
Docutils XML, as docutils --writer=xml writes it.
function astext #
function traverse #
This element and its descendant elements, in document order.
function findAll #
This element and its descendants of kind (all if omitted).
function isElement #
function isText #
function makeId #
name as docutils makes ids of names.
function defaultSettings #
The settings with docutils' defaults.