-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Development: Upgrade markdown library to markdown-it (#9354)
- Loading branch information
1 parent
6e1c562
commit 432efc3
Showing
20 changed files
with
322 additions
and
263 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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 |
---|---|---|
@@ -1,9 +1,4 @@ | ||
declare module 'showdown-katex' { | ||
const main: () => ShowDownExtension; | ||
export = main; | ||
} | ||
|
||
declare module 'showdown-highlight' { | ||
const main: ({ pre: boolean }) => ShowDownExtension; | ||
declare module 'markdown-it-class' { | ||
const main: (md: MarkdownIt) => void; | ||
export = main; | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/webapp/app/shared/markdown-editor/extensions/ArtemisTextReplacementPlugin.ts
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,24 @@ | ||
import type MarkdownIt from 'markdown-it'; | ||
import type { PluginSimple } from 'markdown-it'; | ||
|
||
/** | ||
* Markdown-It plugin that allows replacing text in the raw markdown before tokenizing. | ||
* See more about Markdown-It plugins here: https://github.com/markdown-it/markdown-it/tree/master/docs | ||
*/ | ||
export abstract class ArtemisTextReplacementPlugin { | ||
getExtension(): PluginSimple { | ||
return (md: MarkdownIt): void => { | ||
md.core.ruler.before('normalize', 'artemis_text_replacement', (state) => { | ||
// Perform the replacement on the raw markdown text | ||
state.src = this.replaceText(state.src); | ||
}); | ||
}; | ||
} | ||
|
||
/** | ||
* Performs text replacement on the raw markdown before parsing. | ||
* @param text The raw markdown text. | ||
* @returns The modified markdown text after replacements. | ||
*/ | ||
abstract replaceText(text: string): string; | ||
} |
15 changes: 0 additions & 15 deletions
15
src/main/webapp/app/shared/markdown-editor/extensions/artemis-showdown-extension-wrapper.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.