mirror of
https://github.com/10h30/wordpress-export-to-markdown.git
synced 2026-06-05 15:09:59 +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) {
|
||||
let encoded = post.encoded[0].trim();
|
||||
content = turndownService.turndown(encoded)
|
||||
let content = post.encoded[0].trim();
|
||||
|
||||
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
|
||||
|
||||
return content;
|
||||
|
||||
Reference in New Issue
Block a user