Skip to content

Commit 48a8d44

Browse files
committed
Render Asset descriptions as Markdown
1 parent d69fe27 commit 48a8d44

File tree

4 files changed

+141
-2
lines changed

4 files changed

+141
-2
lines changed

package-lock.json

Lines changed: 135 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
},
3838
"type": "module",
3939
"dependencies": {
40+
"@humanspeak/svelte-markdown": "^0.7.7",
4041
"@svelte-plugins/tooltips": "^3.0.1",
4142
"qrcode": "^1.5.4",
4243
"slugify": "^1.6.6",

src/lib/AssetBox.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts">
22
import type { AssetData } from "$src/types";
33
import Box from "./Box.svelte";
4+
import SvelteMarkdown from '@humanspeak/svelte-markdown'
45
56
interface Props {
67
data: AssetData;
@@ -14,7 +15,9 @@
1415
<div class="asset-name">
1516
<a href="{ data.inventory_url }"> { data.name }</a>
1617
</div>
17-
<p>{@html data.description}</p>
18+
<p>
19+
<SvelteMarkdown source={data.description} />
20+
</p>
1821
</div>
1922
{#if data.picture.url}
2023
<div class="asset-photo">

src/lib/rhinventory_api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export async function loadRHInventoryAssetData(params: {tagId: number, page: num
1919
const response = await fetch(url);
2020
const APIAssets = (await response.json()) as RHInventoryAssetsResponse;
2121

22-
console.log(APIAssets);
22+
console.log(`Loaded ${APIAssets.assets.length} assets from RHInventory API`);
2323

2424
return APIAssets.assets.map(APIAsset => {
2525
return {

0 commit comments

Comments
 (0)