fix: stuff
This commit is contained in:
parent
e22a8da12a
commit
8cf27b3aa7
|
|
@ -36,11 +36,11 @@ export function CardPreview(props: CardPreviewProps) {
|
||||||
let cardRef: HTMLDivElement | undefined;
|
let cardRef: HTMLDivElement | undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="flex justify-center overflow-hidden">
|
<div class="flex justify-center">
|
||||||
<Show when={store.state.activeTab < store.state.cards.length}>
|
<Show when={store.state.activeTab < store.state.cards.length}>
|
||||||
<div
|
<div
|
||||||
ref={cardRef}
|
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={{
|
style={{
|
||||||
width: `${store.state.dimensions?.cardWidth}mm`,
|
width: `${store.state.dimensions?.cardWidth}mm`,
|
||||||
height: `${store.state.dimensions?.cardHeight}mm`
|
height: `${store.state.dimensions?.cardHeight}mm`
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,29 @@
|
||||||
import { Marked } from 'marked';
|
import { Marked } from 'marked';
|
||||||
import { createDirectives } from 'marked-directive';
|
import {createDirectives, presetDirectiveConfigs} from 'marked-directive';
|
||||||
|
|
||||||
// 使用 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 {
|
export function parseMarkdown(content: string): string {
|
||||||
return marked.parse(content.trimStart()) as string;
|
return marked.parse(content.trimStart()) as string;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue