mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	use GFM extensions for markdown export, closes #638
This commit is contained in:
		| @@ -5,7 +5,7 @@ const repository = require('../repository'); | ||||
| const tar = require('tar-stream'); | ||||
| const path = require('path'); | ||||
| const mimeTypes = require('mime-types'); | ||||
| const TurndownService = require('turndown'); | ||||
| const mdService = require('./md'); | ||||
| const packageInfo = require('../../../package.json'); | ||||
| const utils = require('../utils'); | ||||
| const protectedSessionService = require('../protected_session'); | ||||
| @@ -17,8 +17,6 @@ const sanitize = require("sanitize-filename"); | ||||
|  * @param {string} format - 'html' or 'markdown' | ||||
|  */ | ||||
| async function exportToTar(exportContext, branch, format, res) { | ||||
|     let turndownService = format === 'markdown' ? new TurndownService() : null; | ||||
|  | ||||
|     const pack = tar.pack(); | ||||
|  | ||||
|     const noteIdToMeta = {}; | ||||
| @@ -232,7 +230,7 @@ ${content} | ||||
|             return html.prettyPrint(content, {indent_size: 2}); | ||||
|         } | ||||
|         else if (noteMeta.format === 'markdown') { | ||||
|             let markdownContent = turndownService.turndown(content); | ||||
|             let markdownContent = mdService.toMarkdown(content); | ||||
|  | ||||
|             if (markdownContent.trim().length > 0 && !markdownContent.startsWith("# ")) { | ||||
|                 markdownContent = '# ' + title + "\r\n" + markdownContent; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user