fix: stuff

This commit is contained in:
hypercross 2026-02-27 17:54:09 +08:00
parent e22a8da12a
commit 8cf27b3aa7
2 changed files with 25 additions and 4 deletions

View File

@ -36,11 +36,11 @@ export function CardPreview(props: CardPreviewProps) {
let cardRef: HTMLDivElement | undefined;
return (
<div class="flex justify-center overflow-hidden">
<div class="flex justify-center">
<Show when={store.state.activeTab < store.state.cards.length}>
<div
ref={cardRef}
class="relative bg-white border border-gray-300 shadow-lg"
class="relative bg-white border border-gray-300 shadow-lg overflow-hidden"
style={{
width: `${store.state.dimensions?.cardWidth}mm`,
height: `${store.state.dimensions?.cardHeight}mm`

View File

@ -1,8 +1,29 @@
import { Marked } from 'marked';
import { createDirectives } from 'marked-directive';
import {createDirectives, presetDirectiveConfigs} from 'marked-directive';
// 使用 marked-directive 来支持指令语法
const marked = new Marked().use(createDirectives());
const marked = new Marked().use(createDirectives([
...presetDirectiveConfigs,
{
marker: '::::',
level: 'container'
},
{
marker: ':::::',
level: 'container'
},
{
level: 'inline',
marker: ':',
// :[blah] becomes <i class="icon icon-blah"></i>
renderer(token) {
if (!token.meta.name) {
return `<icon class="icon-${token.text}"></icon>`;
}
return false;
}
},
]));
export function parseMarkdown(content: string): string {
return marked.parse(content.trimStart()) as string;