fix(theme): toggle starred on new emojis

Fixes WEB-10
This commit is contained in:
taskylizard 2024-01-24 13:04:39 +00:00
parent 0e69461b59
commit e6d663f128
No known key found for this signature in database
GPG Key ID: 1820131ED1A24120
2 changed files with 6 additions and 2 deletions

View File

@ -11,6 +11,9 @@ export const defs = {
export function emojiRender(md: MarkdownRenderer) { export function emojiRender(md: MarkdownRenderer) {
md.renderer.rules.emoji = (tokens, idx) => { md.renderer.rules.emoji = (tokens, idx) => {
if (tokens[idx].markup.startsWith("star")) {
return `<span class="i-twemoji-${tokens[idx].markup} starred"></span>`;
}
return `<span class="i-twemoji-${tokens[idx].markup}"></span>`; return `<span class="i-twemoji-${tokens[idx].markup}"></span>`;
}; };
} }

View File

@ -8,10 +8,11 @@ export function toggleStarredPlugin(md: MarkdownRenderer) {
if ( if (
!excluded.includes(env.frontmatter.title) && !excluded.includes(env.frontmatter.title) &&
contentToken && contentToken &&
contentToken.content.startsWith("") contentToken.content.startsWith(":star:")
) { ) {
return `<li class="starred">`; return `<li class="starred">`;
} } else {
return self.renderToken(tokens, index, options); return self.renderToken(tokens, index, options);
}
}; };
} }