fix: md-* content
This commit is contained in:
parent
76049f4ce9
commit
a250762ebe
|
|
@ -40,7 +40,7 @@ export const Article: Component<ArticleProps> = (props) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<article ref={articleRef} class="prose prose-lg" data-src={props.src}>
|
<article ref={articleRef} class="prose" data-src={props.src}>
|
||||||
<Show when={loading()}>
|
<Show when={loading()}>
|
||||||
<div class="text-gray-500">加载中...</div>
|
<div class="text-gray-500">加载中...</div>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,11 @@ customElement("md-dice", { key: "" }, (props, { element }) => {
|
||||||
// 从 element 的 textContent 获取骰子公式
|
// 从 element 的 textContent 获取骰子公式
|
||||||
const formula = element?.textContent?.trim() || "";
|
const formula = element?.textContent?.trim() || "";
|
||||||
|
|
||||||
|
// 隐藏原始文本内容
|
||||||
|
if (element) {
|
||||||
|
element.textContent = "";
|
||||||
|
}
|
||||||
|
|
||||||
// 使用的 key(如果没有提供则使用生成的 ID)
|
// 使用的 key(如果没有提供则使用生成的 ID)
|
||||||
const effectiveKey = () => props.key;
|
const effectiveKey = () => props.key;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,11 @@ customElement("md-link", {}, (props, { element }) => {
|
||||||
// 从 element 的 textContent 获取链接目标
|
// 从 element 的 textContent 获取链接目标
|
||||||
const rawLinkSrc = element?.textContent?.trim() || "";
|
const rawLinkSrc = element?.textContent?.trim() || "";
|
||||||
|
|
||||||
|
// 隐藏原始文本内容
|
||||||
|
if (element) {
|
||||||
|
element.textContent = "";
|
||||||
|
}
|
||||||
|
|
||||||
// 从父节点 article 的 data-src 获取当前 markdown 文件完整路径
|
// 从父节点 article 的 data-src 获取当前 markdown 文件完整路径
|
||||||
const articleEl = element?.closest('article[data-src]');
|
const articleEl = element?.closest('article[data-src]');
|
||||||
const articlePath = articleEl?.getAttribute('data-src') || '';
|
const articlePath = articleEl?.getAttribute('data-src') || '';
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,11 @@ customElement('md-table', { roll: false, remix: false }, (props, { element }) =>
|
||||||
// 从 element 的 textContent 获取 CSV 路径
|
// 从 element 的 textContent 获取 CSV 路径
|
||||||
const src = element?.textContent?.trim() || '';
|
const src = element?.textContent?.trim() || '';
|
||||||
|
|
||||||
|
// 隐藏原始文本内容
|
||||||
|
if (element) {
|
||||||
|
element.textContent = '';
|
||||||
|
}
|
||||||
|
|
||||||
// 从父节点 article 的 data-src 获取当前 markdown 文件完整路径
|
// 从父节点 article 的 data-src 获取当前 markdown 文件完整路径
|
||||||
const articleEl = element?.closest('article[data-src]');
|
const articleEl = element?.closest('article[data-src]');
|
||||||
const articlePath = articleEl?.getAttribute('data-src') || '';
|
const articlePath = articleEl?.getAttribute('data-src') || '';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue