fix: 🐛 fix highlight rendering with mixed formatting
This commit is contained in:
parent
91cf1ffdb2
commit
7c9285492c
2
plugin
2
plugin
@ -1 +1 @@
|
||||
Subproject commit c727d49dd50eaf0a1acb9c8e4fe08c2a4cfcb9d5
|
||||
Subproject commit 699b2b93a6c31fb4e2bffebe33af97774e3a5c99
|
@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## [2022-08-16]
|
||||
|
||||
- fix: 🐛 Fix highlights not rendering correctly when mixed with other formatting.
|
||||
|
||||
## [2022-08-11]
|
||||
|
||||
- feat: ✨ Users receive a unique error page when opening expired notes vs. wrong URL.
|
||||
|
@ -61,13 +61,16 @@ const HighlightExtension = {
|
||||
start(src: string) {
|
||||
return src.match(/==/)?.index;
|
||||
},
|
||||
tokenizer(src: string) {
|
||||
tokenizer(src: string): any {
|
||||
const match = src.match(/^==(.+)==/);
|
||||
const text = match ? match[1].trim() : '';
|
||||
if (match) {
|
||||
return {
|
||||
type: 'highlight',
|
||||
raw: match[0].trim(),
|
||||
text: match[1].trim()
|
||||
text: text,
|
||||
// @ts-expect-error - marked types are wrong
|
||||
tokens: this.lexer.inlineTokens(text, [])
|
||||
};
|
||||
}
|
||||
return false;
|
||||
|
@ -2,4 +2,4 @@
|
||||
export let text: string;
|
||||
</script>
|
||||
|
||||
<span class="bg-[#ffff00]/[0.4]">{text}</span>
|
||||
<span class="bg-[#ffff00]/[0.4]"><slot /></span>
|
||||
|
Loading…
Reference in New Issue
Block a user