🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
381
node_modules/rehype-parse/lib/errors.d.ts
generated
vendored
Normal file
381
node_modules/rehype-parse/lib/errors.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,381 @@
|
|||
export namespace errors {
|
||||
namespace abandonedHeadElementChild {
|
||||
const reason: string
|
||||
const description: string
|
||||
const url: boolean
|
||||
}
|
||||
namespace abruptClosingOfEmptyComment {
|
||||
const reason_1: string
|
||||
export {reason_1 as reason}
|
||||
const description_1: string
|
||||
export {description_1 as description}
|
||||
}
|
||||
namespace abruptDoctypePublicIdentifier {
|
||||
const reason_2: string
|
||||
export {reason_2 as reason}
|
||||
const description_2: string
|
||||
export {description_2 as description}
|
||||
}
|
||||
namespace abruptDoctypeSystemIdentifier {
|
||||
const reason_3: string
|
||||
export {reason_3 as reason}
|
||||
const description_3: string
|
||||
export {description_3 as description}
|
||||
}
|
||||
namespace absenceOfDigitsInNumericCharacterReference {
|
||||
const reason_4: string
|
||||
export {reason_4 as reason}
|
||||
const description_4: string
|
||||
export {description_4 as description}
|
||||
}
|
||||
namespace cdataInHtmlContent {
|
||||
const reason_5: string
|
||||
export {reason_5 as reason}
|
||||
const description_5: string
|
||||
export {description_5 as description}
|
||||
}
|
||||
namespace characterReferenceOutsideUnicodeRange {
|
||||
const reason_6: string
|
||||
export {reason_6 as reason}
|
||||
const description_6: string
|
||||
export {description_6 as description}
|
||||
}
|
||||
namespace closingOfElementWithOpenChildElements {
|
||||
const reason_7: string
|
||||
export {reason_7 as reason}
|
||||
const description_7: string
|
||||
export {description_7 as description}
|
||||
const url_1: boolean
|
||||
export {url_1 as url}
|
||||
}
|
||||
namespace controlCharacterInInputStream {
|
||||
const reason_8: string
|
||||
export {reason_8 as reason}
|
||||
const description_8: string
|
||||
export {description_8 as description}
|
||||
}
|
||||
namespace controlCharacterReference {
|
||||
const reason_9: string
|
||||
export {reason_9 as reason}
|
||||
const description_9: string
|
||||
export {description_9 as description}
|
||||
}
|
||||
namespace disallowedContentInNoscriptInHead {
|
||||
const reason_10: string
|
||||
export {reason_10 as reason}
|
||||
const description_10: string
|
||||
export {description_10 as description}
|
||||
const url_2: boolean
|
||||
export {url_2 as url}
|
||||
}
|
||||
namespace duplicateAttribute {
|
||||
const reason_11: string
|
||||
export {reason_11 as reason}
|
||||
const description_11: string
|
||||
export {description_11 as description}
|
||||
}
|
||||
namespace endTagWithAttributes {
|
||||
const reason_12: string
|
||||
export {reason_12 as reason}
|
||||
const description_12: string
|
||||
export {description_12 as description}
|
||||
}
|
||||
namespace endTagWithTrailingSolidus {
|
||||
const reason_13: string
|
||||
export {reason_13 as reason}
|
||||
const description_13: string
|
||||
export {description_13 as description}
|
||||
}
|
||||
namespace endTagWithoutMatchingOpenElement {
|
||||
const reason_14: string
|
||||
export {reason_14 as reason}
|
||||
const description_14: string
|
||||
export {description_14 as description}
|
||||
const url_3: boolean
|
||||
export {url_3 as url}
|
||||
}
|
||||
namespace eofBeforeTagName {
|
||||
const reason_15: string
|
||||
export {reason_15 as reason}
|
||||
const description_15: string
|
||||
export {description_15 as description}
|
||||
}
|
||||
namespace eofInCdata {
|
||||
const reason_16: string
|
||||
export {reason_16 as reason}
|
||||
const description_16: string
|
||||
export {description_16 as description}
|
||||
}
|
||||
namespace eofInComment {
|
||||
const reason_17: string
|
||||
export {reason_17 as reason}
|
||||
const description_17: string
|
||||
export {description_17 as description}
|
||||
}
|
||||
namespace eofInDoctype {
|
||||
const reason_18: string
|
||||
export {reason_18 as reason}
|
||||
const description_18: string
|
||||
export {description_18 as description}
|
||||
}
|
||||
namespace eofInElementThatCanContainOnlyText {
|
||||
const reason_19: string
|
||||
export {reason_19 as reason}
|
||||
const description_19: string
|
||||
export {description_19 as description}
|
||||
const url_4: boolean
|
||||
export {url_4 as url}
|
||||
}
|
||||
namespace eofInScriptHtmlCommentLikeText {
|
||||
const reason_20: string
|
||||
export {reason_20 as reason}
|
||||
const description_20: string
|
||||
export {description_20 as description}
|
||||
}
|
||||
namespace eofInTag {
|
||||
const reason_21: string
|
||||
export {reason_21 as reason}
|
||||
const description_21: string
|
||||
export {description_21 as description}
|
||||
}
|
||||
namespace incorrectlyClosedComment {
|
||||
const reason_22: string
|
||||
export {reason_22 as reason}
|
||||
const description_22: string
|
||||
export {description_22 as description}
|
||||
}
|
||||
namespace incorrectlyOpenedComment {
|
||||
const reason_23: string
|
||||
export {reason_23 as reason}
|
||||
const description_23: string
|
||||
export {description_23 as description}
|
||||
}
|
||||
namespace invalidCharacterSequenceAfterDoctypeName {
|
||||
const reason_24: string
|
||||
export {reason_24 as reason}
|
||||
const description_24: string
|
||||
export {description_24 as description}
|
||||
}
|
||||
namespace invalidFirstCharacterOfTagName {
|
||||
const reason_25: string
|
||||
export {reason_25 as reason}
|
||||
const description_25: string
|
||||
export {description_25 as description}
|
||||
}
|
||||
namespace misplacedDoctype {
|
||||
const reason_26: string
|
||||
export {reason_26 as reason}
|
||||
const description_26: string
|
||||
export {description_26 as description}
|
||||
const url_5: boolean
|
||||
export {url_5 as url}
|
||||
}
|
||||
namespace misplacedStartTagForHeadElement {
|
||||
const reason_27: string
|
||||
export {reason_27 as reason}
|
||||
const description_27: string
|
||||
export {description_27 as description}
|
||||
const url_6: boolean
|
||||
export {url_6 as url}
|
||||
}
|
||||
namespace missingAttributeValue {
|
||||
const reason_28: string
|
||||
export {reason_28 as reason}
|
||||
const description_28: string
|
||||
export {description_28 as description}
|
||||
}
|
||||
namespace missingDoctype {
|
||||
const reason_29: string
|
||||
export {reason_29 as reason}
|
||||
const description_29: string
|
||||
export {description_29 as description}
|
||||
const url_7: boolean
|
||||
export {url_7 as url}
|
||||
}
|
||||
namespace missingDoctypeName {
|
||||
const reason_30: string
|
||||
export {reason_30 as reason}
|
||||
const description_30: string
|
||||
export {description_30 as description}
|
||||
}
|
||||
namespace missingDoctypePublicIdentifier {
|
||||
const reason_31: string
|
||||
export {reason_31 as reason}
|
||||
const description_31: string
|
||||
export {description_31 as description}
|
||||
}
|
||||
namespace missingDoctypeSystemIdentifier {
|
||||
const reason_32: string
|
||||
export {reason_32 as reason}
|
||||
const description_32: string
|
||||
export {description_32 as description}
|
||||
}
|
||||
namespace missingEndTagName {
|
||||
const reason_33: string
|
||||
export {reason_33 as reason}
|
||||
const description_33: string
|
||||
export {description_33 as description}
|
||||
}
|
||||
namespace missingQuoteBeforeDoctypePublicIdentifier {
|
||||
const reason_34: string
|
||||
export {reason_34 as reason}
|
||||
const description_34: string
|
||||
export {description_34 as description}
|
||||
}
|
||||
namespace missingQuoteBeforeDoctypeSystemIdentifier {
|
||||
const reason_35: string
|
||||
export {reason_35 as reason}
|
||||
const description_35: string
|
||||
export {description_35 as description}
|
||||
}
|
||||
namespace missingSemicolonAfterCharacterReference {
|
||||
const reason_36: string
|
||||
export {reason_36 as reason}
|
||||
const description_36: string
|
||||
export {description_36 as description}
|
||||
}
|
||||
namespace missingWhitespaceAfterDoctypePublicKeyword {
|
||||
const reason_37: string
|
||||
export {reason_37 as reason}
|
||||
const description_37: string
|
||||
export {description_37 as description}
|
||||
}
|
||||
namespace missingWhitespaceAfterDoctypeSystemKeyword {
|
||||
const reason_38: string
|
||||
export {reason_38 as reason}
|
||||
const description_38: string
|
||||
export {description_38 as description}
|
||||
}
|
||||
namespace missingWhitespaceBeforeDoctypeName {
|
||||
const reason_39: string
|
||||
export {reason_39 as reason}
|
||||
const description_39: string
|
||||
export {description_39 as description}
|
||||
}
|
||||
namespace missingWhitespaceBetweenAttributes {
|
||||
const reason_40: string
|
||||
export {reason_40 as reason}
|
||||
const description_40: string
|
||||
export {description_40 as description}
|
||||
}
|
||||
namespace missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers {
|
||||
const reason_41: string
|
||||
export {reason_41 as reason}
|
||||
const description_41: string
|
||||
export {description_41 as description}
|
||||
}
|
||||
namespace nestedComment {
|
||||
const reason_42: string
|
||||
export {reason_42 as reason}
|
||||
const description_42: string
|
||||
export {description_42 as description}
|
||||
}
|
||||
namespace nestedNoscriptInHead {
|
||||
const reason_43: string
|
||||
export {reason_43 as reason}
|
||||
const description_43: string
|
||||
export {description_43 as description}
|
||||
const url_8: boolean
|
||||
export {url_8 as url}
|
||||
}
|
||||
namespace nonConformingDoctype {
|
||||
const reason_44: string
|
||||
export {reason_44 as reason}
|
||||
const description_44: string
|
||||
export {description_44 as description}
|
||||
const url_9: boolean
|
||||
export {url_9 as url}
|
||||
}
|
||||
namespace nonVoidHtmlElementStartTagWithTrailingSolidus {
|
||||
const reason_45: string
|
||||
export {reason_45 as reason}
|
||||
const description_45: string
|
||||
export {description_45 as description}
|
||||
}
|
||||
namespace noncharacterCharacterReference {
|
||||
const reason_46: string
|
||||
export {reason_46 as reason}
|
||||
const description_46: string
|
||||
export {description_46 as description}
|
||||
}
|
||||
namespace noncharacterInInputStream {
|
||||
const reason_47: string
|
||||
export {reason_47 as reason}
|
||||
const description_47: string
|
||||
export {description_47 as description}
|
||||
}
|
||||
namespace nullCharacterReference {
|
||||
const reason_48: string
|
||||
export {reason_48 as reason}
|
||||
const description_48: string
|
||||
export {description_48 as description}
|
||||
}
|
||||
namespace openElementsLeftAfterEof {
|
||||
const reason_49: string
|
||||
export {reason_49 as reason}
|
||||
const description_49: string
|
||||
export {description_49 as description}
|
||||
const url_10: boolean
|
||||
export {url_10 as url}
|
||||
}
|
||||
namespace surrogateCharacterReference {
|
||||
const reason_50: string
|
||||
export {reason_50 as reason}
|
||||
const description_50: string
|
||||
export {description_50 as description}
|
||||
}
|
||||
namespace surrogateInInputStream {
|
||||
const reason_51: string
|
||||
export {reason_51 as reason}
|
||||
const description_51: string
|
||||
export {description_51 as description}
|
||||
}
|
||||
namespace unexpectedCharacterAfterDoctypeSystemIdentifier {
|
||||
const reason_52: string
|
||||
export {reason_52 as reason}
|
||||
const description_52: string
|
||||
export {description_52 as description}
|
||||
}
|
||||
namespace unexpectedCharacterInAttributeName {
|
||||
const reason_53: string
|
||||
export {reason_53 as reason}
|
||||
const description_53: string
|
||||
export {description_53 as description}
|
||||
}
|
||||
namespace unexpectedCharacterInUnquotedAttributeValue {
|
||||
const reason_54: string
|
||||
export {reason_54 as reason}
|
||||
const description_54: string
|
||||
export {description_54 as description}
|
||||
}
|
||||
namespace unexpectedEqualsSignBeforeAttributeName {
|
||||
const reason_55: string
|
||||
export {reason_55 as reason}
|
||||
const description_55: string
|
||||
export {description_55 as description}
|
||||
}
|
||||
namespace unexpectedNullCharacter {
|
||||
const reason_56: string
|
||||
export {reason_56 as reason}
|
||||
const description_56: string
|
||||
export {description_56 as description}
|
||||
}
|
||||
namespace unexpectedQuestionMarkInsteadOfTagName {
|
||||
const reason_57: string
|
||||
export {reason_57 as reason}
|
||||
const description_57: string
|
||||
export {description_57 as description}
|
||||
}
|
||||
namespace unexpectedSolidusInTag {
|
||||
const reason_58: string
|
||||
export {reason_58 as reason}
|
||||
const description_58: string
|
||||
export {description_58 as description}
|
||||
}
|
||||
namespace unknownNamedCharacterReference {
|
||||
const reason_59: string
|
||||
export {reason_59 as reason}
|
||||
const description_59: string
|
||||
export {description_59 as description}
|
||||
}
|
||||
}
|
||||
278
node_modules/rehype-parse/lib/errors.js
generated
vendored
Normal file
278
node_modules/rehype-parse/lib/errors.js
generated
vendored
Normal file
|
|
@ -0,0 +1,278 @@
|
|||
export const errors = {
|
||||
abandonedHeadElementChild: {
|
||||
reason: 'Unexpected metadata element after head',
|
||||
description:
|
||||
'Unexpected element after head. Expected the element before `</head>`',
|
||||
url: false
|
||||
},
|
||||
abruptClosingOfEmptyComment: {
|
||||
reason: 'Unexpected abruptly closed empty comment',
|
||||
description: 'Unexpected `>` or `->`. Expected `-->` to close comments'
|
||||
},
|
||||
abruptDoctypePublicIdentifier: {
|
||||
reason: 'Unexpected abruptly closed public identifier',
|
||||
description:
|
||||
'Unexpected `>`. Expected a closing `"` or `\'` after the public identifier'
|
||||
},
|
||||
abruptDoctypeSystemIdentifier: {
|
||||
reason: 'Unexpected abruptly closed system identifier',
|
||||
description:
|
||||
'Unexpected `>`. Expected a closing `"` or `\'` after the identifier identifier'
|
||||
},
|
||||
absenceOfDigitsInNumericCharacterReference: {
|
||||
reason: 'Unexpected non-digit at start of numeric character reference',
|
||||
description:
|
||||
'Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references'
|
||||
},
|
||||
cdataInHtmlContent: {
|
||||
reason: 'Unexpected CDATA section in HTML',
|
||||
description:
|
||||
'Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead'
|
||||
},
|
||||
characterReferenceOutsideUnicodeRange: {
|
||||
reason: 'Unexpected too big numeric character reference',
|
||||
description:
|
||||
'Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)'
|
||||
},
|
||||
closingOfElementWithOpenChildElements: {
|
||||
reason: 'Unexpected closing tag with open child elements',
|
||||
description:
|
||||
'Unexpectedly closing tag. Expected other tags to be closed first',
|
||||
url: false
|
||||
},
|
||||
controlCharacterInInputStream: {
|
||||
reason: 'Unexpected control character',
|
||||
description:
|
||||
'Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace'
|
||||
},
|
||||
controlCharacterReference: {
|
||||
reason: 'Unexpected control character reference',
|
||||
description:
|
||||
'Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace'
|
||||
},
|
||||
disallowedContentInNoscriptInHead: {
|
||||
reason: 'Disallowed content inside `<noscript>` in `<head>`',
|
||||
description:
|
||||
'Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`',
|
||||
url: false
|
||||
},
|
||||
duplicateAttribute: {
|
||||
reason: 'Unexpected duplicate attribute',
|
||||
description:
|
||||
'Unexpectedly double attribute. Expected attributes to occur only once'
|
||||
},
|
||||
endTagWithAttributes: {
|
||||
reason: 'Unexpected attribute on closing tag',
|
||||
description: 'Unexpected attribute. Expected `>` instead'
|
||||
},
|
||||
endTagWithTrailingSolidus: {
|
||||
reason: 'Unexpected slash at end of closing tag',
|
||||
description: 'Unexpected `%c-1`. Expected `>` instead'
|
||||
},
|
||||
endTagWithoutMatchingOpenElement: {
|
||||
reason: 'Unexpected unopened end tag',
|
||||
description: 'Unexpected end tag. Expected no end tag or another end tag',
|
||||
url: false
|
||||
},
|
||||
eofBeforeTagName: {
|
||||
reason: 'Unexpected end of file',
|
||||
description: 'Unexpected end of file. Expected tag name instead'
|
||||
},
|
||||
eofInCdata: {
|
||||
reason: 'Unexpected end of file in CDATA',
|
||||
description: 'Unexpected end of file. Expected `]]>` to close the CDATA'
|
||||
},
|
||||
eofInComment: {
|
||||
reason: 'Unexpected end of file in comment',
|
||||
description: 'Unexpected end of file. Expected `-->` to close the comment'
|
||||
},
|
||||
eofInDoctype: {
|
||||
reason: 'Unexpected end of file in doctype',
|
||||
description:
|
||||
'Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)'
|
||||
},
|
||||
eofInElementThatCanContainOnlyText: {
|
||||
reason: 'Unexpected end of file in element that can only contain text',
|
||||
description: 'Unexpected end of file. Expected text or a closing tag',
|
||||
url: false
|
||||
},
|
||||
eofInScriptHtmlCommentLikeText: {
|
||||
reason: 'Unexpected end of file in comment inside script',
|
||||
description: 'Unexpected end of file. Expected `-->` to close the comment'
|
||||
},
|
||||
eofInTag: {
|
||||
reason: 'Unexpected end of file in tag',
|
||||
description: 'Unexpected end of file. Expected `>` to close the tag'
|
||||
},
|
||||
incorrectlyClosedComment: {
|
||||
reason: 'Incorrectly closed comment',
|
||||
description: 'Unexpected `%c-1`. Expected `-->` to close the comment'
|
||||
},
|
||||
incorrectlyOpenedComment: {
|
||||
reason: 'Incorrectly opened comment',
|
||||
description: 'Unexpected `%c`. Expected `<!--` to open the comment'
|
||||
},
|
||||
invalidCharacterSequenceAfterDoctypeName: {
|
||||
reason: 'Invalid sequence after doctype name',
|
||||
description: 'Unexpected sequence at `%c`. Expected `public` or `system`'
|
||||
},
|
||||
invalidFirstCharacterOfTagName: {
|
||||
reason: 'Invalid first character in tag name',
|
||||
description: 'Unexpected `%c`. Expected an ASCII letter instead'
|
||||
},
|
||||
misplacedDoctype: {
|
||||
reason: 'Misplaced doctype',
|
||||
description: 'Unexpected doctype. Expected doctype before head',
|
||||
url: false
|
||||
},
|
||||
misplacedStartTagForHeadElement: {
|
||||
reason: 'Misplaced `<head>` start tag',
|
||||
description:
|
||||
'Unexpected start tag `<head>`. Expected `<head>` directly after doctype',
|
||||
url: false
|
||||
},
|
||||
missingAttributeValue: {
|
||||
reason: 'Missing attribute value',
|
||||
description:
|
||||
'Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead'
|
||||
},
|
||||
missingDoctype: {
|
||||
reason: 'Missing doctype before other content',
|
||||
description: 'Expected a `<!doctype html>` before anything else',
|
||||
url: false
|
||||
},
|
||||
missingDoctypeName: {
|
||||
reason: 'Missing doctype name',
|
||||
description: 'Unexpected doctype end at `%c`. Expected `html` instead'
|
||||
},
|
||||
missingDoctypePublicIdentifier: {
|
||||
reason: 'Missing public identifier in doctype',
|
||||
description: 'Unexpected `%c`. Expected identifier for `public` instead'
|
||||
},
|
||||
missingDoctypeSystemIdentifier: {
|
||||
reason: 'Missing system identifier in doctype',
|
||||
description:
|
||||
'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'
|
||||
},
|
||||
missingEndTagName: {
|
||||
reason: 'Missing name in end tag',
|
||||
description: 'Unexpected `%c`. Expected an ASCII letter instead'
|
||||
},
|
||||
missingQuoteBeforeDoctypePublicIdentifier: {
|
||||
reason: 'Missing quote before public identifier in doctype',
|
||||
description: 'Unexpected `%c`. Expected `"` or `\'` instead'
|
||||
},
|
||||
missingQuoteBeforeDoctypeSystemIdentifier: {
|
||||
reason: 'Missing quote before system identifier in doctype',
|
||||
description: 'Unexpected `%c`. Expected `"` or `\'` instead'
|
||||
},
|
||||
missingSemicolonAfterCharacterReference: {
|
||||
reason: 'Missing semicolon after character reference',
|
||||
description: 'Unexpected `%c`. Expected `;` instead'
|
||||
},
|
||||
missingWhitespaceAfterDoctypePublicKeyword: {
|
||||
reason: 'Missing whitespace after public identifier in doctype',
|
||||
description: 'Unexpected `%c`. Expected ASCII whitespace instead'
|
||||
},
|
||||
missingWhitespaceAfterDoctypeSystemKeyword: {
|
||||
reason: 'Missing whitespace after system identifier in doctype',
|
||||
description: 'Unexpected `%c`. Expected ASCII whitespace instead'
|
||||
},
|
||||
missingWhitespaceBeforeDoctypeName: {
|
||||
reason: 'Missing whitespace before doctype name',
|
||||
description: 'Unexpected `%c`. Expected ASCII whitespace instead'
|
||||
},
|
||||
missingWhitespaceBetweenAttributes: {
|
||||
reason: 'Missing whitespace between attributes',
|
||||
description: 'Unexpected `%c`. Expected ASCII whitespace instead'
|
||||
},
|
||||
missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers: {
|
||||
reason:
|
||||
'Missing whitespace between public and system identifiers in doctype',
|
||||
description: 'Unexpected `%c`. Expected ASCII whitespace instead'
|
||||
},
|
||||
nestedComment: {
|
||||
reason: 'Unexpected nested comment',
|
||||
description: 'Unexpected `<!--`. Expected `-->`'
|
||||
},
|
||||
nestedNoscriptInHead: {
|
||||
reason: 'Unexpected nested `<noscript>` in `<head>`',
|
||||
description:
|
||||
'Unexpected `<noscript>`. Expected a closing tag or a meta element',
|
||||
url: false
|
||||
},
|
||||
nonConformingDoctype: {
|
||||
reason: 'Unexpected non-conforming doctype declaration',
|
||||
description:
|
||||
'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',
|
||||
url: false
|
||||
},
|
||||
nonVoidHtmlElementStartTagWithTrailingSolidus: {
|
||||
reason: 'Unexpected trailing slash on start tag of non-void element',
|
||||
description: 'Unexpected `/`. Expected `>` instead'
|
||||
},
|
||||
noncharacterCharacterReference: {
|
||||
reason:
|
||||
'Unexpected noncharacter code point referenced by character reference',
|
||||
description: 'Unexpected code point. Do not use noncharacters in HTML'
|
||||
},
|
||||
noncharacterInInputStream: {
|
||||
reason: 'Unexpected noncharacter character',
|
||||
description: 'Unexpected code point `%x`. Do not use noncharacters in HTML'
|
||||
},
|
||||
nullCharacterReference: {
|
||||
reason: 'Unexpected NULL character referenced by character reference',
|
||||
description: 'Unexpected code point. Do not use NULL characters in HTML'
|
||||
},
|
||||
openElementsLeftAfterEof: {
|
||||
reason: 'Unexpected end of file',
|
||||
description: 'Unexpected end of file. Expected closing tag instead',
|
||||
url: false
|
||||
},
|
||||
surrogateCharacterReference: {
|
||||
reason: 'Unexpected surrogate character referenced by character reference',
|
||||
description:
|
||||
'Unexpected code point. Do not use lone surrogate characters in HTML'
|
||||
},
|
||||
surrogateInInputStream: {
|
||||
reason: 'Unexpected surrogate character',
|
||||
description:
|
||||
'Unexpected code point `%x`. Do not use lone surrogate characters in HTML'
|
||||
},
|
||||
unexpectedCharacterAfterDoctypeSystemIdentifier: {
|
||||
reason: 'Invalid character after system identifier in doctype',
|
||||
description: 'Unexpected character at `%c`. Expected `>`'
|
||||
},
|
||||
unexpectedCharacterInAttributeName: {
|
||||
reason: 'Unexpected character in attribute name',
|
||||
description:
|
||||
'Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter'
|
||||
},
|
||||
unexpectedCharacterInUnquotedAttributeValue: {
|
||||
reason: 'Unexpected character in unquoted attribute value',
|
||||
description: 'Unexpected `%c`. Quote the attribute value to include it'
|
||||
},
|
||||
unexpectedEqualsSignBeforeAttributeName: {
|
||||
reason: 'Unexpected equals sign before attribute name',
|
||||
description: 'Unexpected `%c`. Add an attribute name before it'
|
||||
},
|
||||
unexpectedNullCharacter: {
|
||||
reason: 'Unexpected NULL character',
|
||||
description:
|
||||
'Unexpected code point `%x`. Do not use NULL characters in HTML'
|
||||
},
|
||||
unexpectedQuestionMarkInsteadOfTagName: {
|
||||
reason: 'Unexpected question mark instead of tag name',
|
||||
description: 'Unexpected `%c`. Expected an ASCII letter instead'
|
||||
},
|
||||
unexpectedSolidusInTag: {
|
||||
reason: 'Unexpected slash in tag',
|
||||
description:
|
||||
'Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value'
|
||||
},
|
||||
unknownNamedCharacterReference: {
|
||||
reason: 'Unexpected unknown named character reference',
|
||||
description:
|
||||
'Unexpected character reference. Expected known named character references'
|
||||
}
|
||||
}
|
||||
286
node_modules/rehype-parse/lib/index.d.ts
generated
vendored
Normal file
286
node_modules/rehype-parse/lib/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,286 @@
|
|||
/** @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
|
||||
123
node_modules/rehype-parse/lib/index.js
generated
vendored
Normal file
123
node_modules/rehype-parse/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
/**
|
||||
* @typedef {import('hast').Root} Root
|
||||
* @typedef {Pick<import('hast-util-from-parse5').Options, 'space' | 'verbose'>} FromParse5Options
|
||||
*
|
||||
* @typedef {keyof errors} ErrorCode
|
||||
* @typedef {0|1|2|boolean|null|undefined} ErrorSeverity
|
||||
* @typedef {Partial<Record<ErrorCode, ErrorSeverity>>} ErrorFields
|
||||
*
|
||||
* @typedef ParseFields
|
||||
* @property {boolean|undefined} [fragment=false]
|
||||
* 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.
|
||||
* @property {boolean|undefined} [emitParseErrors=false]
|
||||
* > ⚠️ 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.
|
||||
*
|
||||
* @typedef {FromParse5Options & ParseFields & ErrorFields} Options
|
||||
*/
|
||||
|
||||
// @ts-expect-error: remove when typed
|
||||
import Parser5 from 'parse5/lib/parser/index.js'
|
||||
import {fromParse5} from 'hast-util-from-parse5'
|
||||
import {errors} from './errors.js'
|
||||
|
||||
const base = 'https://html.spec.whatwg.org/multipage/parsing.html#parse-error-'
|
||||
|
||||
const fatalities = {2: true, 1: false, 0: null}
|
||||
|
||||
/** @type {import('unified').Plugin<[Options?] | Array<void>, string, Root>} */
|
||||
export default function rehypeParse(options) {
|
||||
const processorSettings = /** @type {Options} */ (this.data('settings'))
|
||||
const settings = Object.assign({}, processorSettings, options)
|
||||
|
||||
Object.assign(this, {Parser: parser})
|
||||
|
||||
/** @type {import('unified').ParserFunction<Root>} */
|
||||
function parser(doc, file) {
|
||||
const fn = settings.fragment ? 'parseFragment' : 'parse'
|
||||
const onParseError = settings.emitParseErrors ? onerror : null
|
||||
const parse5 = new Parser5({
|
||||
sourceCodeLocationInfo: true,
|
||||
onParseError,
|
||||
scriptingEnabled: false
|
||||
})
|
||||
|
||||
// @ts-expect-error: `parse5` returns document or fragment, which are always
|
||||
// mapped to roots.
|
||||
return fromParse5(parse5[fn](doc), {
|
||||
space: settings.space,
|
||||
file,
|
||||
verbose: settings.verbose
|
||||
})
|
||||
|
||||
/**
|
||||
* @param {{code: string, startLine: number, startCol: number, startOffset: number, endLine: number, endCol: number, endOffset: number}} error
|
||||
*/
|
||||
function onerror(error) {
|
||||
const code = error.code
|
||||
const name = camelcase(code)
|
||||
const setting = settings[name]
|
||||
const config = setting === undefined || setting === null ? true : setting
|
||||
const level = typeof config === 'number' ? config : config ? 1 : 0
|
||||
const start = {
|
||||
line: error.startLine,
|
||||
column: error.startCol,
|
||||
offset: error.startOffset
|
||||
}
|
||||
const end = {
|
||||
line: error.endLine,
|
||||
column: error.endCol,
|
||||
offset: error.endOffset
|
||||
}
|
||||
if (level) {
|
||||
/* c8 ignore next */
|
||||
const info = errors[name] || {reason: '', description: '', url: ''}
|
||||
const message = file.message(format(info.reason), {start, end})
|
||||
message.source = 'parse-error'
|
||||
message.ruleId = code
|
||||
message.fatal = fatalities[level]
|
||||
message.note = format(info.description)
|
||||
message.url = 'url' in info && info.url === false ? null : base + code
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @returns {string}
|
||||
*/
|
||||
function format(value) {
|
||||
return value
|
||||
.replace(/%c(?:-(\d+))?/g, (_, /** @type {string} */ $1) => {
|
||||
const offset = $1 ? -Number.parseInt($1, 10) : 0
|
||||
const char = doc.charAt(error.startOffset + offset)
|
||||
return char === '`' ? '` ` `' : char
|
||||
})
|
||||
.replace(
|
||||
/%x/g,
|
||||
() =>
|
||||
'0x' +
|
||||
doc.charCodeAt(error.startOffset).toString(16).toUpperCase()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @returns {ErrorCode}
|
||||
*/
|
||||
function camelcase(value) {
|
||||
// @ts-expect-error: this returns a valid error code.
|
||||
return value.replace(/-[a-z]/g, ($0) => $0.charAt(1).toUpperCase())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue