mirror of
https://github.com/10h30/wordpress-export-to-markdown.git
synced 2026-07-11 18:56:14 +09:00
Adjust post content image srcs when using --addcontentimages
This commit is contained in:
@@ -187,8 +187,15 @@ function getPostDate(post) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getPostContent(post, turndownService) {
|
function getPostContent(post, turndownService) {
|
||||||
let encoded = post.encoded[0].trim();
|
let content = post.encoded[0].trim();
|
||||||
content = turndownService.turndown(encoded)
|
|
||||||
|
if (argv.addcontentimages) {
|
||||||
|
// writeImageFile() will save all content images to a relative /images folder
|
||||||
|
// so update references in post content to match
|
||||||
|
content = content.replace(/src=".*?([^\/"]+\.(gif|jpg|png))"/gi, 'src="images/$1"');
|
||||||
|
}
|
||||||
|
|
||||||
|
content = turndownService.turndown(content)
|
||||||
.replace(/-\s+/g, '- '); // clean up extra spaces
|
.replace(/-\s+/g, '- '); // clean up extra spaces
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
|
|||||||
Reference in New Issue
Block a user