mirror of
https://github.com/10h30/wordpress-export-to-markdown.git
synced 2026-06-05 15:09:59 +09:00
preserve <figure> and <figcaption>
This commit is contained in:
+9
-1
@@ -9,7 +9,6 @@ function initTurndownService() {
|
||||
});
|
||||
|
||||
turndownService.use(turndownPluginGfm.tables);
|
||||
turndownService.keep(['iframe']);
|
||||
|
||||
// preserve embedded tweets
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user