File tree Expand file tree Collapse file tree 5 files changed +12
-8
lines changed
Expand file tree Collapse file tree 5 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @dbushell/hyperless" ,
3- "version" : " 0.29 .0" ,
3+ "version" : " 0.30 .0" ,
44 "exports" : {
55 "." : " ./mod.ts"
66 },
Original file line number Diff line number Diff line change 11{
22 "name" : " @dbushell/hyperless" ,
3- "version" : " 0.29 .0" ,
3+ "version" : " 0.30 .0" ,
44 "repository" : {
55 "type" : " git" ,
66 "url" : " git+https://github.com/dbushell/hyperspace.git"
Original file line number Diff line number Diff line change @@ -4,21 +4,25 @@ import { inlineTags } from "./html-tags.ts";
44/**
55 * Merge adjacent text and inline Nodes into single text Node
66 * @param node HTML Node
7+ * @param customTags Custom inline tags
78 */
8- export const mergeInlineNodes = ( node : Node ) : void => {
9+ export const mergeInlineNodes = (
10+ node : Node ,
11+ customTags : Set < string > = new Set ( ) ,
12+ ) : void => {
913 for ( const child of [ ...node . children ] ) {
1014 if ( child . type === "OPAQUE" ) {
1115 continue ;
1216 }
1317 // Recursively merge sub-tree first
14- mergeInlineNodes ( child ) ;
18+ mergeInlineNodes ( child , customTags ) ;
1519 // Merge this text node into the previous text node
1620 if ( child . type === "TEXT" && child . previous ?. type === "TEXT" ) {
1721 child . previous . raw += child . toString ( ) ;
1822 child . detach ( ) ;
1923 continue ;
2024 }
21- if ( inlineTags . has ( child . tag ) ) {
25+ if ( inlineTags . has ( child . tag ) || customTags . has ( child . tag ) ) {
2226 // Merge this inline node into previous text node
2327 if ( child . previous ?. type === "TEXT" ) {
2428 child . previous . raw += child . toString ( ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @dbushell/hypermore" ,
3- "version" : " 0.30 .0" ,
3+ "version" : " 0.31 .0" ,
44 "exports" : {
55 "." : " ./mod.ts"
66 },
Original file line number Diff line number Diff line change 11{
22 "name" : " @dbushell/hypermore" ,
3- "version" : " 0.30 .0" ,
3+ "version" : " 0.31 .0" ,
44 "repository" : {
55 "type" : " git" ,
66 "url" : " git+https://github.com/dbushell/hyperspace.git"
2323 " README.md"
2424 ],
2525 "dependencies" : {
26- "@dbushell/hyperless" : " ^0.29 .0"
26+ "@dbushell/hyperless" : " ^0.30 .0"
2727 }
2828}
You can’t perform that action at this time.
0 commit comments