-
Notifications
You must be signed in to change notification settings - Fork 66
3.1.0: long-standing community fixes + release prep #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
a30dfe9
publish html-parse-stringify.d.ts
jiangfengming d020e06
Update html-parse-stringify.d.ts
jiangfengming 3bf0a49
Add failing test
2baf587
The text following the comment has been discarded
fc9c190
Update html-parse-stringify.d.ts
jiangfengming 0a42382
Fix regexp
steffanhalv 2ebb962
fix bug, when text content contains <
adrai a2659e6
feat: add LICENSE file
monholm 83568c9
Merge pull request #66 from monholm/license
adrai 968130a
Merge pull request #63 from steffanhalv/fix/multiline-attribute
adrai 71e05d6
Merge pull request #51 from jiangfengming/patch-1
adrai bb1e1d2
Merge pull request #52 from jiangfengming/patch-2
adrai 709a2de
Merge pull request #64 from adrai/master
adrai 1ca9624
Merge pull request #53 from tohosaku/fix_discarding_text
adrai e1b9349
cleanup after community PR merges + 3.1.0 release notes
adrai 25a332c
test: fix copy-pasted assertion messages (Copilot review)
adrai f324559
fix: make the mismatched-bracket pre-pass quote-aware and skip comments
adrai 274a47c
fix: address second review round (#67)
adrai 73a3578
fix: validate split fragments in the bracket pre-pass
adrai 3461eea
chore: bump version to 3.1.0
adrai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 Henrik Joreteg <henrik@joreteg.com> | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,43 @@ | ||
| declare var htmlParseStringify: htmlParseStringify.htmlParseStringify | ||
| declare module 'html-parse-stringify' { | ||
| namespace HTML { | ||
| interface TagNode { | ||
| type: 'tag'; | ||
| name: string; | ||
| voidElement: boolean; | ||
| attrs: Record<string, string | undefined>; | ||
| children: Node[]; | ||
| } | ||
|
|
||
| declare module htmlParseStringify { | ||
| export interface htmlParseStringify { | ||
| new (): htmlParseStringify | ||
| parse_tag(tag: string): IDoc | ||
| parse(html: string, options: IOptions): Array<any> | ||
| stringify(doc: IDoc): string | ||
| } | ||
| interface TextNode { | ||
| type: 'text'; | ||
| content: string; | ||
| } | ||
|
|
||
| export interface IDoc { | ||
| type: string | ||
| content?: string | ||
| voidElement: boolean | ||
| name: string | ||
| attrs: {} | ||
| children: IDoc[] | ||
| } | ||
| interface CommentNode { | ||
| type: 'comment'; | ||
| comment: string; | ||
| } | ||
|
|
||
| interface ComponentNode { | ||
| type: 'component'; | ||
| name: string; | ||
| attrs: Record<string, string | undefined>; | ||
| voidElement: boolean; | ||
| children: []; | ||
| } | ||
|
|
||
| export interface IOptions { | ||
| components: string[] | ||
| type Node = TagNode | TextNode | CommentNode | ComponentNode; | ||
|
|
||
| interface ParseOptions { | ||
| components?: Record<string, boolean>; | ||
| } | ||
|
|
||
| function parse(html: string, options?: ParseOptions): Node[]; | ||
| function stringify(doc: Node[]): string; | ||
| } | ||
| } | ||
|
|
||
| declare module 'html-parse-stringify' { | ||
| export = htmlParseStringify | ||
| // the CommonJS build assigns `module.exports = { parse, stringify }` with | ||
| // no `default` property, so `export =` is the only declaration shape that | ||
| // is correct both with and without esModuleInterop | ||
| export = HTML; | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new multiline pattern explicitly handles
\n, but.does not match\r. As a result, attributes containing Windows-style CRLF line endings are still not parsed.For example:
when the line break is
\r\n, producesattrs: {}on this branch rather than:Please use a pattern that covers every line terminator, such as quote-specific negated character classes, and add a CRLF regression test alongside the LF case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 274a47c: attrRE now uses quote-specific negated classes (
"[^"]*"|'[^']*'), which covers every line terminator (and drops the backtracking-prone(.|\n)*?while at it). CRLF regression tests added for both quote styles.