kishare 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Project list component - displays navigation sidebar
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Marked } from 'marked';
|
|
6
6
|
import { baseUrl } from 'marked-base-url';
|
|
7
7
|
import DOMPurify from 'dompurify';
|
|
8
8
|
import type { ProjectMetadata, GitInfo } from '../lib/project-index.js';
|
|
@@ -246,9 +246,11 @@ export class ProjectList extends HTMLElement {
|
|
|
246
246
|
* Render markdown content (used for live doc display)
|
|
247
247
|
*/
|
|
248
248
|
private renderMarkdown(markdown: string, projectPath: string): string {
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
// Create new instance to avoid global scope issues on project change
|
|
250
|
+
const marked = new Marked();
|
|
251
|
+
marked.use(baseUrl(`${projectPath}/`));
|
|
251
252
|
const html = marked.parse(markdown) as string;
|
|
253
|
+
|
|
252
254
|
return DOMPurify.sanitize(html, {
|
|
253
255
|
ALLOWED_TAGS: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'br', 'strong', 'em', 'code', 'pre', 'a', 'img', 'ul', 'ol', 'li', 'blockquote'],
|
|
254
256
|
ALLOWED_ATTR: ['href', 'src', 'alt', 'title', 'target', 'rel'],
|