Skip to content

Commit

Permalink
General: Add support for markdown callouts (#10158)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-lippert authored Jan 17, 2025
1 parent 54422e7 commit e4fcadf
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
13 changes: 13 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"lodash-es": "4.17.21",
"markdown-it": "14.1.0",
"markdown-it-class": "1.0.0",
"markdown-it-github-alerts": "0.3.0",
"markdown-it-highlightjs": "4.2.0",
"mobile-drag-drop": "3.0.0-rc.0",
"monaco-editor": "0.52.2",
Expand Down
5 changes: 3 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 @@ -6,7 +6,7 @@ import markdownItClass from 'markdown-it-class';
import markdownItKatex from '@vscode/markdown-it-katex';
import markdownItHighlightjs from 'markdown-it-highlightjs';
import TurndownService from 'turndown';

import MarkdownItGitHubAlerts from 'markdown-it-github-alerts';
/**
* Add these classes to the converted html.
*/
Expand Down Expand Up @@ -66,12 +66,13 @@ export function htmlForMarkdown(
md.use(extension);
}

// Add default extensions (Code Highlight, Latex)
// Add default extensions (Code Highlight, Latex, Alerts)
md.use(markdownItHighlightjs)
.use(formulaCompatibilityPlugin.getExtension())
.use(markdownItKatex, {
enableMathInlineInHtml: true,
})
.use(MarkdownItGitHubAlerts)
.use(markdownItClass, classMap);
let markdownRender = md.render(markdownText);
if (markdownRender.endsWith('\n')) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/webapp/content/scss/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
@import 'node_modules/@siemens/ngx-datatable/themes/bootstrap';
// Needed for emojis in metis reactions
@import 'node_modules/@ctrl/ngx-emoji-mart/picker';
// Needed for markdown-it-github-alerts and markdown callouts
@import 'markdown-it-github-alerts/styles/github-colors-light.css';
@import 'markdown-it-github-alerts/styles/github-colors-dark-media.css';
@import 'markdown-it-github-alerts/styles/github-base.css';

// Smooth transition between themes
* {
Expand Down

0 comments on commit e4fcadf

Please sign in to comment.