286 lines
6.4 KiB
TypeScript
286 lines
6.4 KiB
TypeScript
/** @type {import('unified').Plugin<[Options?] | Array<void>, string, Root>} */
|
|
export default function rehypeParse(options: void | Options | undefined): void
|
|
export type Root = import('hast').Root
|
|
export type FromParse5Options = Pick<
|
|
import('hast-util-from-parse5').Options,
|
|
'space' | 'verbose'
|
|
>
|
|
export type ErrorCode = keyof {
|
|
abandonedHeadElementChild: {
|
|
reason: string
|
|
description: string
|
|
url: boolean
|
|
}
|
|
abruptClosingOfEmptyComment: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
abruptDoctypePublicIdentifier: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
abruptDoctypeSystemIdentifier: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
absenceOfDigitsInNumericCharacterReference: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
cdataInHtmlContent: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
characterReferenceOutsideUnicodeRange: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
closingOfElementWithOpenChildElements: {
|
|
reason: string
|
|
description: string
|
|
url: boolean
|
|
}
|
|
/** @type {Options} */
|
|
controlCharacterInInputStream: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
controlCharacterReference: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
disallowedContentInNoscriptInHead: {
|
|
reason: string
|
|
description: string
|
|
url: boolean
|
|
}
|
|
duplicateAttribute: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
endTagWithAttributes: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
endTagWithTrailingSolidus: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
endTagWithoutMatchingOpenElement: {
|
|
reason: string
|
|
description: string
|
|
url: boolean
|
|
}
|
|
eofBeforeTagName: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
eofInCdata: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
eofInComment: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
eofInDoctype: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
eofInElementThatCanContainOnlyText: {
|
|
reason: string
|
|
description: string
|
|
url: boolean
|
|
}
|
|
eofInScriptHtmlCommentLikeText: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
eofInTag: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
incorrectlyClosedComment: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
incorrectlyOpenedComment: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
invalidCharacterSequenceAfterDoctypeName: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
invalidFirstCharacterOfTagName: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
misplacedDoctype: {
|
|
reason: string
|
|
description: string
|
|
url: boolean
|
|
}
|
|
misplacedStartTagForHeadElement: {
|
|
reason: string
|
|
description: string
|
|
url: boolean
|
|
}
|
|
missingAttributeValue: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
missingDoctype: {
|
|
reason: string
|
|
description: string
|
|
url: boolean
|
|
}
|
|
missingDoctypeName: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
missingDoctypePublicIdentifier: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
missingDoctypeSystemIdentifier: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
missingEndTagName: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
missingQuoteBeforeDoctypePublicIdentifier: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
missingQuoteBeforeDoctypeSystemIdentifier: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
missingSemicolonAfterCharacterReference: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
missingWhitespaceAfterDoctypePublicKeyword: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
missingWhitespaceAfterDoctypeSystemKeyword: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
missingWhitespaceBeforeDoctypeName: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
missingWhitespaceBetweenAttributes: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
nestedComment: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
nestedNoscriptInHead: {
|
|
reason: string
|
|
description: string
|
|
url: boolean
|
|
}
|
|
nonConformingDoctype: {
|
|
reason: string
|
|
description: string
|
|
url: boolean
|
|
}
|
|
nonVoidHtmlElementStartTagWithTrailingSolidus: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
noncharacterCharacterReference: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
noncharacterInInputStream: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
nullCharacterReference: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
openElementsLeftAfterEof: {
|
|
reason: string
|
|
description: string
|
|
url: boolean
|
|
}
|
|
surrogateCharacterReference: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
surrogateInInputStream: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
unexpectedCharacterAfterDoctypeSystemIdentifier: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
unexpectedCharacterInAttributeName: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
unexpectedCharacterInUnquotedAttributeValue: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
unexpectedEqualsSignBeforeAttributeName: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
unexpectedNullCharacter: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
unexpectedQuestionMarkInsteadOfTagName: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
unexpectedSolidusInTag: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
unknownNamedCharacterReference: {
|
|
reason: string
|
|
description: string
|
|
}
|
|
}
|
|
export type ErrorSeverity = 0 | 1 | 2 | boolean | null | undefined
|
|
export type ErrorFields = Partial<Record<ErrorCode, ErrorSeverity>>
|
|
export type ParseFields = {
|
|
/**
|
|
* Specify whether to parse a fragment, instead of a complete document.
|
|
* In document mode, unopened `html`, `head`, and `body` elements are opened
|
|
* in just the right places.
|
|
*/
|
|
fragment?: boolean | undefined
|
|
/**
|
|
* > ⚠️ Parse errors are currently being added to HTML.
|
|
* > Not all errors emitted by parse5 (or rehype-parse) are specced yet.
|
|
* > Some documentation may still be missing.
|
|
*
|
|
* Emit parse errors while parsing on the vfile.
|
|
* Setting this to `true` starts emitting HTML parse errors.
|
|
*
|
|
* Specific rules can be turned off by setting them to `false` (or `0`).
|
|
* The default, when `emitParseErrors: true`, is `true` (or `1`), and means
|
|
* that rules emit as warnings.
|
|
* Rules can also be configured with `2`, to turn them into fatal errors.
|
|
*/
|
|
emitParseErrors?: boolean | undefined
|
|
}
|
|
export type Options = FromParse5Options & ParseFields & ErrorFields
|