3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-19 22:55:44 +01:00

Answer the stability review: the parse layer strips a space or a tab, never more

This commit is contained in:
2026-08-28 00:01:35 +02:00
parent 087952555d
commit 6c2b5afbaa
7 changed files with 45 additions and 18 deletions
+2 -1
View File
@@ -2,6 +2,7 @@ import type { AdfDocument, AdfNode } from '../../adf/document.ts'
import type { ClaimedConstruct, LeafBlock } from './blocks.ts'
import { failure, success, type ConvertErrorPath, type Result } from '../../result.ts'
import { parseBlocks } from './blocks.ts'
import { trimSpace } from '../commonmark-grammar.ts'
export function markdownToAdf(markdown: string): Result<AdfDocument> {
const content: AdfNode[] = []
@@ -40,7 +41,7 @@ function withContent(node: AdfNode, text: string): AdfNode {
function inlineContent(text: string): AdfNode[] {
const line = text
.split('\n')
.map((part) => part.trim())
.map((part) => trimSpace(part))
.join(' ')
return line === '' ? [] : [{ text: line, type: 'text' }]
}