MCPcopy Create free account
hub / github.com/TruthHun/BookStack / cell

Function cell

static/word2md/turndown-plugin-gfm.js:124–135  ·  view source on GitHub ↗
(content, node)

Source from the content-addressed store, hash-verified

122
123//修复,当表格中有换行时,解析不正确,修复表格为空时,增加3个空格,确保能正确解析
124function cell(content, node) {
125 var index = indexOf.call(node.parentNode.childNodes, node);
126 var prefix = ' ';
127 content = content.replace("\n", "<br/>")
128 if (index === 0)
129 prefix = '| ';
130 let filteredContent = content.trim().replace(/\n\r/g, '<br/>').replace(/\n/g, "<br/>");
131 filteredContent = filteredContent.replace(/\|+/g, '\\|');
132 while (filteredContent.length < 3)
133 filteredContent += ' ';
134 return prefix + filteredContent + ' |'
135}
136
137function tables (turndownService) {
138 turndownService.keep(function (node) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected