mirror of
https://github.com/fmhy/edit.git
synced 2025-11-28 00:41:20 +11:00
Update toggleStarred.ts
This commit is contained in:
parent
2003db4584
commit
b866a618a1
1 changed files with 11 additions and 7 deletions
|
|
@ -13,7 +13,6 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { MarkdownRenderer } from 'vitepress'
|
import type { MarkdownRenderer } from 'vitepress'
|
||||||
|
|
||||||
const excluded = ['Beginners Guide']
|
const excluded = ['Beginners Guide']
|
||||||
|
|
@ -25,12 +24,17 @@ export function toggleStarredPlugin(md: MarkdownRenderer) {
|
||||||
!excluded.includes(env.frontmatter.title) &&
|
!excluded.includes(env.frontmatter.title) &&
|
||||||
contentToken &&
|
contentToken &&
|
||||||
(
|
(
|
||||||
contentToken.content.includes(':star:') || // Check if it contains ⭐
|
contentToken.content.includes(':star:') ||
|
||||||
contentToken.content.includes(':star2:') // Check if it contains 🌟
|
contentToken.content.includes(':star2:')
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
return `<li class="starred">`
|
// Replace the placeholders with HTML
|
||||||
|
contentToken.content = contentToken.content
|
||||||
|
.replace(':star:', '<span class="star">⭐</span>') // Use HTML for star
|
||||||
|
.replace(':star2:', '<span class="star2">🌟</span>'); // Use HTML for star2
|
||||||
|
|
||||||
|
return `<li class="starred">`;
|
||||||
}
|
}
|
||||||
return self.renderToken(tokens, index, options)
|
return self.renderToken(tokens, index, options);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue