feat: pass source path to markdown parser for icon resolution
Pass the file's base path through the markdown parsing pipeline to allow the icon directive to resolve relative asset paths correctly using an absolute fallback chain.
This commit is contained in:
@@ -135,7 +135,7 @@ export const Article: Component<ArticleProps & ParentProps> = (props) => {
|
||||
<div
|
||||
class="relative"
|
||||
ref={setContentDom}
|
||||
innerHTML={parseMarkdown(content()!)}
|
||||
innerHTML={parseMarkdown(content()!, props.src)}
|
||||
/>
|
||||
{props.children}
|
||||
</ArticleDomCtx.Provider>
|
||||
|
||||
@@ -27,6 +27,7 @@ export function CardLayer(props: CardLayerProps) {
|
||||
function renderLayerContent(content: string) {
|
||||
return parseMarkdown(
|
||||
processVariables(content, props.cardData, props.store.state.cards),
|
||||
props.store.state.cards.sourcePath,
|
||||
) as string;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,10 @@ customElement("md-embed", { headingBase: 0 }, (props, { element }) => {
|
||||
</Show>
|
||||
<Show when={!content.loading && !content.error && content()}>
|
||||
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: markdown render */}
|
||||
<div class="prose" innerHTML={parseMarkdown(content()!)} />
|
||||
<div
|
||||
class="prose"
|
||||
innerHTML={parseMarkdown(content()!, resolvedPath)}
|
||||
/>
|
||||
</Show>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user