bug when no table pleasant
parent
15dae35b74
commit
0ab94c807e
2
index.js
2
index.js
|
@ -92,6 +92,7 @@ function read_url(url, res) {
|
||||||
|
|
||||||
function format_tables(html, replacements) {
|
function format_tables(html, replacements) {
|
||||||
const tables = html.match(/(<table[^>]*>(?:.|\n)*?<\/table>)/gi);
|
const tables = html.match(/(<table[^>]*>(?:.|\n)*?<\/table>)/gi);
|
||||||
|
if (tables) {
|
||||||
for (let t=0;t<tables.length;t++) {
|
for (let t=0;t<tables.length;t++) {
|
||||||
let table = tables[t];
|
let table = tables[t];
|
||||||
let markdown = table_to_markdown.convert(table);
|
let markdown = table_to_markdown.convert(table);
|
||||||
|
@ -100,6 +101,7 @@ function format_tables(html, replacements) {
|
||||||
replacements.tables[t] = markdown;
|
replacements.tables[t] = markdown;
|
||||||
html = html.replace(table, "<p>"+placeholder+"</p>");
|
html = html.replace(table, "<p>"+placeholder+"</p>");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue