mirror of
https://github.com/10h30/wordpress-export-to-markdown.git
synced 2026-07-19 14:43:58 +09:00
preserve <figure> and <figcaption>
This commit is contained in:
+9
-1
@@ -9,7 +9,6 @@ function initTurndownService() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
turndownService.use(turndownPluginGfm.tables);
|
turndownService.use(turndownPluginGfm.tables);
|
||||||
turndownService.keep(['iframe']);
|
|
||||||
|
|
||||||
// preserve embedded tweets
|
// preserve embedded tweets
|
||||||
turndownService.addRule('tweet', {
|
turndownService.addRule('tweet', {
|
||||||
@@ -56,6 +55,15 @@ function initTurndownService() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// preserve <figure> and <figcaption>
|
||||||
|
turndownService.addRule('fig', {
|
||||||
|
filter: ['figure', 'figcaption'],
|
||||||
|
replacement: (content, node) => {
|
||||||
|
const tagName = node.nodeName.toLowerCase();
|
||||||
|
return '<' + tagName + '>' + content + '</' + tagName + '>';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return turndownService;
|
return turndownService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user