forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmd-plugin-table.js
More file actions
32 lines (24 loc) · 839 Bytes
/
md-plugin-table.js
File metadata and controls
32 lines (24 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* Converts table to QMarkupTable
*/
module.exports = function (md) {
md.renderer.rules.table_open = (tokens, idx, options, env, self) => {
const token = tokens[idx]
token.tag = 'q-markup-table'
token.attrSet(':wrap-cells', 'true')
token.attrSet(':flat', 'true')
token.attrSet(':bordered', 'true')
token.attrSet('style', 'width: fit-content; max-width: 100%;')
return self.renderToken(tokens, idx, options)
}
md.renderer.rules.table_close = (tokens, idx, options, env, self) => {
const token = tokens[idx]
token.tag = 'q-markup-table'
return self.renderToken(tokens, idx, options)
}
md.renderer.rules.th_open = (tokens, idx, options, env, self) => {
const token = tokens[idx]
token.attrSet('class', 'text-left')
return self.renderToken(tokens, idx, options)
}
}