improve markdown import and export

This commit is contained in:
Salihu
2026-08-09 20:40:03 +01:00
parent b77b84602d
commit 9ba93c87c0
3 changed files with 34 additions and 17 deletions
@@ -69,7 +69,7 @@ function tabs(turndownService: _TurndownService) {
const isNestedTabsNode =
node.parentElement?.closest('div[data-type="tabs"]') !== null;
const tabBlocks = tabNodes.map((tabNode, index) => {
const labelNode = tabNode.querySelector(
':scope > div[data-type="tabLabel"]',
@@ -279,15 +279,16 @@ function video(turndownService: _TurndownService) {
function sanitizeTabLabel(value: string): string {
return value
.replace(/[\r\n]+/g, ' ')
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.trim();
}
function indentMarkdownBlock(content: string): string {
if (!content) return ' ';
if (!content) return '\t';
return content
.split('\n')
.map((line) => (line.trim() ? ` ${line}` : ''))
.map((line) => (line.trim() ? `\t${line}` : ''))
.join('\n');
}