Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support MultiMarkdown tables #2125 #2126

Merged
merged 1 commit into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/components/editor/editor-markdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ import mdAbbr from 'markdown-it-abbr'
import mdSup from 'markdown-it-sup'
import mdSub from 'markdown-it-sub'
import mdMark from 'markdown-it-mark'
import mdMultiTable from 'markdown-it-multimd-table'
import mdFootnote from 'markdown-it-footnote'
import mdImsize from 'markdown-it-imsize'
import katex from 'katex'
Expand Down Expand Up @@ -287,6 +288,7 @@ const md = new MarkdownIt({
.use(mdAbbr)
.use(mdSup)
.use(mdSub)
.use(mdMultiTable, {multiline: true, rowspan: true, headerless: true})
.use(mdMark)
.use(mdFootnote)
.use(mdImsize)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"markdown-it-imsize": "2.0.1",
"markdown-it-mark": "3.0.0",
"markdown-it-mathjax": "2.0.0",
"markdown-it-multimd-table": "4.0.2",
"markdown-it-sub": "1.0.0",
"markdown-it-sup": "1.0.0",
"markdown-it-task-lists": "2.1.1",
Expand Down
23 changes: 23 additions & 0 deletions server/modules/rendering/markdown-multi-table/definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
key: markdownMultiTable
title: MultiMarkdown Table
description: Add MultiMarkdown table support
author: requarks.io
icon: mdi-table
enabledDefault: false
dependsOn: markdownCore
props:
multilineEnabled:
type: Boolean
title: Multiline
hint: Enable multiple lines rows
default: true
headerlessEnabled:
type: Boolean
title: Headerless
hint: Enable ommited table headers
default: true
rowspanEnabled:
type: Boolean
title: Rowspan
hint: Enable table row spans
default: true
11 changes: 11 additions & 0 deletions server/modules/rendering/markdown-multi-table/renderer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const multiTable = require('markdown-it-multimd-table')

module.exports = {
init (md, conf) {
md.use(multiTable, {
multiline: conf.multilineEnabled,
rowspan: conf.rowspanEnabled,
headerless: conf.headerlessEnabled
})
}
}
25 changes: 25 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11163,6 +11163,13 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=

linkify-it@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-2.2.0.tgz#e3b54697e78bf915c70a38acd78fd09e0058b1cf"
integrity sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==
dependencies:
uc.micro "^1.0.1"

linkify-it@^3.0.1:
version "3.0.2"
resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-3.0.2.tgz#f55eeb8bc1d3ae754049e124ab3bb56d97797fb8"
Expand Down Expand Up @@ -11596,6 +11603,13 @@ markdown-it-mathjax@2.0.0:
resolved "https://registry.yarnpkg.com/markdown-it-mathjax/-/markdown-it-mathjax-2.0.0.tgz#ae2b4f4c5c719a03f9e475c664f7b2685231d9e9"
integrity sha1-ritPTFxxmgP55HXGZPeyaFIx2ek=

markdown-it-multimd-table@4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/markdown-it-multimd-table/-/markdown-it-multimd-table-4.0.2.tgz#3dfbdb35356fa5e3de85e6868985dddcd1051e17"
integrity sha512-SlcssTj7FoYstVQ7MsM8A46/lhbN1K6/q0e9v56o/5kaWmTheXZXQX3nuZgw7WQocn+3nyQGcoO7ovcqeFxaAw==
dependencies:
markdown-it "^8.4.2"

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"
Expand All @@ -11622,6 +11636,17 @@ markdown-it@11.0.0:
mdurl "^1.0.1"
uc.micro "^1.0.5"

markdown-it@^8.4.2:
version "8.4.2"
resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-8.4.2.tgz#386f98998dc15a37722aa7722084f4020bdd9b54"
integrity sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==
dependencies:
argparse "^1.0.7"
entities "~1.1.1"
linkify-it "^2.0.0"
mdurl "^1.0.1"
uc.micro "^1.0.5"

math-expression-evaluator@^1.2.14:
version "1.2.17"
resolved "https://registry.yarnpkg.com/math-expression-evaluator/-/math-expression-evaluator-1.2.17.tgz#de819fdbcd84dccd8fae59c6aeb79615b9d266ac"
Expand Down