-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom component for markdown with new-tab links
That way instead of having to do a Typescript cast every time we want to render Markdown that opens links in a new tab, we can do the cast once and just call a different component. We've done this already for the lexbox frontend code in src/, so we'll do the same thing for the viewer.
- Loading branch information
Showing
3 changed files
with
13 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
frontend/viewer/src/lib/markdown/NewTabLinKMarkdown.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<script lang="ts"> | ||
import Markdown, {type ComponentsMap} from 'svelte-exmarkdown'; | ||
import type {Component} from 'svelte'; | ||
import NewTabLinkRenderer from './NewTabLinkRenderer.svelte'; | ||
export let md: string; | ||
const renderer: ComponentsMap = { a: NewTabLinkRenderer as unknown as Component }; | ||
</script> | ||
|
||
<Markdown {md} plugins={[{ renderer: renderer }]} /> |
File renamed without changes.