Merge pull request #232 from codimd/feature/emphasisPlugins

Emphasis plugins
This commit is contained in:
Philip Molares 2020-06-20 19:21:52 +02:00 committed by GitHub
commit e309f4e608
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 56 additions and 0 deletions

View file

@ -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",

View file

@ -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)

View file

@ -0,0 +1,6 @@
declare module 'markdown-it-ins' {
import MarkdownIt from 'markdown-it/lib'
const markdownItInserted: MarkdownIt.PluginSimple
export = markdownItInserted
}

View file

@ -0,0 +1,6 @@
declare module 'markdown-it-mark' {
import MarkdownIt from 'markdown-it/lib'
const markdownItMark: MarkdownIt.PluginSimple
export = markdownItMark
}

View file

@ -0,0 +1,6 @@
declare module 'markdown-it-sub' {
import MarkdownIt from 'markdown-it/lib'
const markdownItSubscript: MarkdownIt.PluginSimple
export = markdownItSubscript
}

View file

@ -0,0 +1,6 @@
declare module 'markdown-it-sup' {
import MarkdownIt from 'markdown-it/lib'
const markdownItSuperscript: MarkdownIt.PluginSimple
export = markdownItSuperscript
}

View file

@ -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"