mirror of
https://github.com/10h30/wordpress-export-to-markdown.git
synced 2026-07-14 04:06:45 +09:00
Refactor turndown service init
This commit is contained in:
+5
-4
@@ -2,7 +2,10 @@ import turndownPluginGfm from '@guyplusplus/turndown-plugin-gfm';
|
||||
import turndown from 'turndown';
|
||||
import * as shared from './shared.js';
|
||||
|
||||
export function initTurndownService() {
|
||||
// init single reusable turndown service object upon import
|
||||
const turndownService = initTurndownService();
|
||||
|
||||
function initTurndownService() {
|
||||
const turndownService = new turndown({
|
||||
headingStyle: 'atx',
|
||||
bulletListMarker: '-',
|
||||
@@ -95,9 +98,7 @@ export function initTurndownService() {
|
||||
return turndownService;
|
||||
}
|
||||
|
||||
export function getPostContent(postData, turndownService) {
|
||||
let content = postData.encoded[0];
|
||||
|
||||
export function getPostContent(content) {
|
||||
// insert an empty div element between double line breaks
|
||||
// this nifty trick causes turndown to keep adjacent paragraphs separated
|
||||
// without mucking up content inside of other elements (like <code> blocks)
|
||||
|
||||
Reference in New Issue
Block a user