Skip to content

Commit

Permalink
use different markdown library
Browse files Browse the repository at this point in the history
  • Loading branch information
Strohgelaender committed Sep 22, 2024
1 parent c6e771c commit 1bb82dc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 32 deletions.
1 change: 0 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"rfdc",
"shallowequal",
"markdown-it-class",
"@iktakahiro/markdown-it-katex",
"smoothscroll-polyfill",
"sockjs-client",
"use-sync-external-store/shim",
Expand Down
28 changes: 10 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"@fortawesome/fontawesome-svg-core": "6.6.0",
"@fortawesome/free-regular-svg-icons": "6.6.0",
"@fortawesome/free-solid-svg-icons": "6.6.0",
"@iktakahiro/markdown-it-katex": "4.0.1",
"@ls1intum/apollon": "3.3.14",
"@ng-bootstrap/ng-bootstrap": "17.0.1",
"@ngx-translate/core": "15.0.0",
Expand All @@ -42,6 +41,7 @@
"@swimlane/ngx-charts": "20.5.0",
"@swimlane/ngx-graph": "8.4.0",
"@vscode/codicons": "0.0.36",
"@vscode/markdown-it-katex": "1.1.0",
"bootstrap": "5.3.3",
"compare-versions": "6.1.1",
"core-js": "3.38.1",
Expand Down Expand Up @@ -102,13 +102,9 @@
"@typescript-eslint/eslint-plugin": "^8.6.0"
},
"jsdom": "25.0.0",
"katex": "0.16.11",
"postcss": "8.4.47",
"rimraf": "6.0.1",
"semver": "7.6.3",
"showdown-katex": {
"showdown": "2.1.0"
},
"tough-cookie": "5.0.0",
"vite": "5.4.6",
"webpack-dev-middleware": "7.4.2",
Expand Down Expand Up @@ -136,7 +132,6 @@
"@types/markdown-it": "14.1.2",
"@types/node": "22.5.5",
"@types/papaparse": "5.3.14",
"@types/showdown": "2.0.6",
"@types/smoothscroll-polyfill": "0.3.4",
"@types/sockjs-client": "1.5.4",
"@types/turndown": "5.0.5",
Expand Down
5 changes: 0 additions & 5 deletions src/main/webapp/app/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,3 @@ declare module 'markdown-it-class' {
const main: (md: MarkdownIt) => void;
export = main;
}

declare module '@iktakahiro/markdown-it-katex' {
const main: (md: MarkdownIt) => void;
export = main;
}
4 changes: 2 additions & 2 deletions src/main/webapp/app/shared/util/markdown.conversion.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import DOMPurify, { Config } from 'dompurify';
import type { PluginSimple } from 'markdown-it';
import markdownIt from 'markdown-it';
import markdownItClass from 'markdown-it-class';
import markdownItKatex from '@iktakahiro/markdown-it-katex';
import markdownItKatex from '@vscode/markdown-it-katex';
import markdown_it_highlightjs from 'markdown-it-highlightjs';
import TurndownService from 'turndown';

Expand All @@ -12,6 +12,7 @@ import TurndownService from 'turndown';
const classMap: { [key: string]: string } = {
table: 'table',
};

/**
* Converts markdown into html (string) and sanitizes it. Does NOT declare it as safe to bypass further security
* Note: If possible, please use safeHtmlForMarkdown
Expand Down Expand Up @@ -43,7 +44,6 @@ export function htmlForMarkdown(

// Add default extensions (Code Highlight, Latex)
md = md.use(markdown_it_highlightjs).use(markdownItKatex).use(markdownItClass, classMap);

let markdownRender = md.render(markdownText);
if (markdownRender.endsWith('\n')) {
// Keep legacy behavior from showdown where the output does not end with \n.
Expand Down

0 comments on commit 1bb82dc

Please sign in to comment.