mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
Merge pull request #232 from codimd/feature/emphasisPlugins
Emphasis plugins
This commit is contained in:
commit
e309f4e608
7 changed files with 56 additions and 0 deletions
|
@ -39,7 +39,11 @@
|
||||||
"i18next-http-backend": "1.0.15",
|
"i18next-http-backend": "1.0.15",
|
||||||
"markdown-it": "11.0.0",
|
"markdown-it": "11.0.0",
|
||||||
"markdown-it-emoji": "1.4.0",
|
"markdown-it-emoji": "1.4.0",
|
||||||
|
"markdown-it-ins": "^3.0.0",
|
||||||
|
"markdown-it-mark": "^3.0.0",
|
||||||
"markdown-it-regex": "0.2.0",
|
"markdown-it-regex": "0.2.0",
|
||||||
|
"markdown-it-sub": "^1.0.0",
|
||||||
|
"markdown-it-sup": "^1.0.0",
|
||||||
"markdown-it-task-lists": "2.1.1",
|
"markdown-it-task-lists": "2.1.1",
|
||||||
"moment": "2.27.0",
|
"moment": "2.27.0",
|
||||||
"node-sass": "4.14.1",
|
"node-sass": "4.14.1",
|
||||||
|
|
|
@ -2,6 +2,10 @@ import MarkdownIt from 'markdown-it'
|
||||||
import emoji from 'markdown-it-emoji'
|
import emoji from 'markdown-it-emoji'
|
||||||
import markdownItRegex from 'markdown-it-regex'
|
import markdownItRegex from 'markdown-it-regex'
|
||||||
import taskList from 'markdown-it-task-lists'
|
import taskList from 'markdown-it-task-lists'
|
||||||
|
import subscript from 'markdown-it-sub'
|
||||||
|
import superscript from 'markdown-it-sup'
|
||||||
|
import inserted from 'markdown-it-ins'
|
||||||
|
import marked from 'markdown-it-mark'
|
||||||
import React, { ReactElement, useMemo } from 'react'
|
import React, { ReactElement, useMemo } from 'react'
|
||||||
import ReactHtmlParser, { convertNodeToElement, Transform } from 'react-html-parser'
|
import ReactHtmlParser, { convertNodeToElement, Transform } from 'react-html-parser'
|
||||||
import { MarkdownItParserDebugger } from './markdown-it-plugins/parser-debugger'
|
import { MarkdownItParserDebugger } from './markdown-it-plugins/parser-debugger'
|
||||||
|
@ -35,6 +39,10 @@ const MarkdownPreview: React.FC<MarkdownPreviewProps> = ({ content }) => {
|
||||||
})
|
})
|
||||||
md.use(taskList)
|
md.use(taskList)
|
||||||
md.use(emoji)
|
md.use(emoji)
|
||||||
|
md.use(subscript)
|
||||||
|
md.use(superscript)
|
||||||
|
md.use(inserted)
|
||||||
|
md.use(marked)
|
||||||
md.use(markdownItRegex, replaceLegacyYoutubeShortCode)
|
md.use(markdownItRegex, replaceLegacyYoutubeShortCode)
|
||||||
md.use(markdownItRegex, replaceLegacyVimeoShortCode)
|
md.use(markdownItRegex, replaceLegacyVimeoShortCode)
|
||||||
md.use(markdownItRegex, replaceLegacyGistShortCode)
|
md.use(markdownItRegex, replaceLegacyGistShortCode)
|
||||||
|
|
6
src/external-types/markdown-it-ins/index.d.ts
vendored
Normal file
6
src/external-types/markdown-it-ins/index.d.ts
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
declare module 'markdown-it-ins' {
|
||||||
|
import MarkdownIt from 'markdown-it/lib'
|
||||||
|
const markdownItInserted: MarkdownIt.PluginSimple
|
||||||
|
export = markdownItInserted
|
||||||
|
}
|
6
src/external-types/markdown-it-mark/index.d.ts
vendored
Normal file
6
src/external-types/markdown-it-mark/index.d.ts
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
declare module 'markdown-it-mark' {
|
||||||
|
import MarkdownIt from 'markdown-it/lib'
|
||||||
|
const markdownItMark: MarkdownIt.PluginSimple
|
||||||
|
export = markdownItMark
|
||||||
|
}
|
6
src/external-types/markdown-it-sub/index.d.ts
vendored
Normal file
6
src/external-types/markdown-it-sub/index.d.ts
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
declare module 'markdown-it-sub' {
|
||||||
|
import MarkdownIt from 'markdown-it/lib'
|
||||||
|
const markdownItSubscript: MarkdownIt.PluginSimple
|
||||||
|
export = markdownItSubscript
|
||||||
|
}
|
6
src/external-types/markdown-it-sup/index.d.ts
vendored
Normal file
6
src/external-types/markdown-it-sup/index.d.ts
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
declare module 'markdown-it-sup' {
|
||||||
|
import MarkdownIt from 'markdown-it/lib'
|
||||||
|
const markdownItSuperscript: MarkdownIt.PluginSimple
|
||||||
|
export = markdownItSuperscript
|
||||||
|
}
|
20
yarn.lock
20
yarn.lock
|
@ -7275,11 +7275,31 @@ markdown-it-emoji@1.4.0:
|
||||||
resolved "https://registry.yarnpkg.com/markdown-it-emoji/-/markdown-it-emoji-1.4.0.tgz#9bee0e9a990a963ba96df6980c4fddb05dfb4dcc"
|
resolved "https://registry.yarnpkg.com/markdown-it-emoji/-/markdown-it-emoji-1.4.0.tgz#9bee0e9a990a963ba96df6980c4fddb05dfb4dcc"
|
||||||
integrity sha1-m+4OmpkKljupbfaYDE/dsF37Tcw=
|
integrity sha1-m+4OmpkKljupbfaYDE/dsF37Tcw=
|
||||||
|
|
||||||
|
markdown-it-ins@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/markdown-it-ins/-/markdown-it-ins-3.0.0.tgz#b1b56824c78dc66e52b0fc97531b317cd78d79d2"
|
||||||
|
integrity sha512-+vyAdBuMGwmT2yMlAFJSx2VR/0QZ1onQ/Mkkmr4l9tDFOh5sVoAgRbkgbuSsk+sxJ9vaMH/IQ323ydfvQrPO/Q==
|
||||||
|
|
||||||
|
markdown-it-mark@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/markdown-it-mark/-/markdown-it-mark-3.0.0.tgz#27c3e39ef3cc310b2dde5375082c9fa912983cda"
|
||||||
|
integrity sha512-HqMWeKfMMOu4zBO0emmxsoMWmbf2cPKZY1wP6FsTbKmicFfp5y4L3KXAsNeO1rM6NTJVOrNlLKMPjWzriBGspw==
|
||||||
|
|
||||||
markdown-it-regex@0.2.0:
|
markdown-it-regex@0.2.0:
|
||||||
version "0.2.0"
|
version "0.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/markdown-it-regex/-/markdown-it-regex-0.2.0.tgz#e09ad2d75209720d591d3949e1142c75c0fbecf6"
|
resolved "https://registry.yarnpkg.com/markdown-it-regex/-/markdown-it-regex-0.2.0.tgz#e09ad2d75209720d591d3949e1142c75c0fbecf6"
|
||||||
integrity sha512-111UnMGJSt37gy+DlgcpQNwEfS2jvscOFSztzGhuXUHk7K1J5eAEj6C3jifmKb0cWtTuxdpHgIt4PyGQ+DtDjw==
|
integrity sha512-111UnMGJSt37gy+DlgcpQNwEfS2jvscOFSztzGhuXUHk7K1J5eAEj6C3jifmKb0cWtTuxdpHgIt4PyGQ+DtDjw==
|
||||||
|
|
||||||
|
markdown-it-sub@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/markdown-it-sub/-/markdown-it-sub-1.0.0.tgz#375fd6026eae7ddcb012497f6411195ea1e3afe8"
|
||||||
|
integrity sha1-N1/WAm6ufdywEkl/ZBEZXqHjr+g=
|
||||||
|
|
||||||
|
markdown-it-sup@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/markdown-it-sup/-/markdown-it-sup-1.0.0.tgz#cb9c9ff91a5255ac08f3fd3d63286e15df0a1fc3"
|
||||||
|
integrity sha1-y5yf+RpSVawI8/09YyhuFd8KH8M=
|
||||||
|
|
||||||
markdown-it-task-lists@2.1.1:
|
markdown-it-task-lists@2.1.1:
|
||||||
version "2.1.1"
|
version "2.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/markdown-it-task-lists/-/markdown-it-task-lists-2.1.1.tgz#f68f4d2ac2bad5a2c373ba93081a1a6848417088"
|
resolved "https://registry.yarnpkg.com/markdown-it-task-lists/-/markdown-it-task-lists-2.1.1.tgz#f68f4d2ac2bad5a2c373ba93081a1a6848417088"
|
||||||
|
|
Loading…
Reference in a new issue