fix: add a span as wrapper to fix whitespace (#747)

This commit is contained in:
M. Gschwandtner 2022-12-15 01:45:20 +01:00 committed by GitHub
parent 35fed76d1a
commit 334da5e903
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 8 deletions

View File

@ -60,8 +60,8 @@ console.log("hello world!")
- [ ] finish my homework - [ ] finish my homework
- [x] yahaha`, - [x] yahaha`,
want: `<p>My task:</p> want: `<p>My task:</p>
<p class='li-container'><span class='todo-block todo' data-value='TODO'></span>finish my homework</p> <p class='li-container'><span class='todo-block todo' data-value='TODO'></span><span>finish my homework</span></p>
<p class='li-container'><span class='todo-block done' data-value='DONE'></span>yahaha</p>`, <p class='li-container'><span class='todo-block done' data-value='DONE'></span><span>yahaha</span></p>`,
}, },
]; ];
@ -76,8 +76,8 @@ console.log("hello world!")
* list 123 * list 123
1. 123123`, 1. 123123`,
want: `<p>This is a list</p> want: `<p>This is a list</p>
<p class='li-container'><span class='ul-block'></span>list 123</p> <p class='li-container'><span class='ul-block'></span><span>list 123</span></p>
<p class='li-container'><span class='ol-block'>1.</span>123123</p>`, <p class='li-container'><span class='ol-block'>1.</span><span>123123</span></p>`,
}, },
]; ];

View File

@ -10,7 +10,7 @@ const renderer = (rawStr: string): string => {
} }
const parsedContent = marked(matchResult[1], [], inlineElementParserList); const parsedContent = marked(matchResult[1], [], inlineElementParserList);
return `<p class='li-container'><span class='todo-block done' data-value='DONE'>✓</span>${parsedContent}</p>${matchResult[2]}`; return `<p class='li-container'><span class='todo-block done' data-value='DONE'>✓</span><span>${parsedContent}</span></p>${matchResult[2]}`;
}; };
export default { export default {

View File

@ -10,7 +10,7 @@ const renderer = (rawStr: string): string => {
} }
const parsedContent = marked(matchResult[2], [], inlineElementParserList); const parsedContent = marked(matchResult[2], [], inlineElementParserList);
return `<p class='li-container'><span class='ol-block'>${matchResult[1]}.</span>${parsedContent}</p>${matchResult[3]}`; return `<p class='li-container'><span class='ol-block'>${matchResult[1]}.</span><span>${parsedContent}</span></p>${matchResult[3]}`;
}; };
export default { export default {

View File

@ -11,7 +11,9 @@ const renderer = (rawStr: string): string => {
} }
const parsedContent = marked(matchResult[1], [], inlineElementParserList); const parsedContent = marked(matchResult[1], [], inlineElementParserList);
return `<p class='li-container'><span class='todo-block todo' data-value='TODO'></span>${parsedContent}</p>${escape(matchResult[2])}`; return `<p class='li-container'><span class='todo-block todo' data-value='TODO'></span><span>${parsedContent}</span></p>${escape(
matchResult[2]
)}`;
}; };
export default { export default {

View File

@ -11,7 +11,7 @@ const renderer = (rawStr: string): string => {
} }
const parsedContent = marked(matchResult[1], [], inlineElementParserList); const parsedContent = marked(matchResult[1], [], inlineElementParserList);
return `<p class='li-container'><span class='ul-block'>•</span>${parsedContent}</p>${escape(matchResult[2])}`; return `<p class='li-container'><span class='ul-block'>•</span><span>${parsedContent}</span></p>${escape(matchResult[2])}`;
}; };
export default { export default {