fenced 블록 탐색 helper 통합
This commit is contained in:
@@ -2,11 +2,48 @@ import assert from 'node:assert/strict'
|
||||
import test from 'node:test'
|
||||
import {
|
||||
collectFencedLines,
|
||||
findFencedBlockEnd,
|
||||
findFencedBlockStart,
|
||||
findFencedBlockStartBy,
|
||||
parseBookmarkMeta,
|
||||
parseMediaMeta,
|
||||
parseSignupMeta
|
||||
} from '../lib/markdown-fenced-meta.js'
|
||||
|
||||
test('fenced 블록 시작과 종료 줄을 찾는다', () => {
|
||||
const lines = [
|
||||
'이전',
|
||||
':::gallery',
|
||||
'',
|
||||
':::',
|
||||
'다음'
|
||||
]
|
||||
|
||||
assert.equal(findFencedBlockStart(lines, 2, ':::gallery'), 1)
|
||||
assert.equal(findFencedBlockEnd(lines, 1), 3)
|
||||
})
|
||||
|
||||
test('닫힘 표식 너머의 fenced 블록 시작은 현재 블록으로 보지 않는다', () => {
|
||||
const lines = [
|
||||
':::gallery',
|
||||
'',
|
||||
':::',
|
||||
'본문'
|
||||
]
|
||||
|
||||
assert.equal(findFencedBlockStart(lines, 3, ':::gallery'), -1)
|
||||
})
|
||||
|
||||
test('조건 기반 fenced 블록 시작 줄을 찾는다', () => {
|
||||
const lines = [
|
||||
':::callout emoji=none bg=blue',
|
||||
'본문',
|
||||
':::'
|
||||
]
|
||||
|
||||
assert.equal(findFencedBlockStartBy(lines, 1, (line) => line.startsWith(':::callout')), 0)
|
||||
})
|
||||
|
||||
test('fenced 블록 닫힘 표식까지의 본문과 다음 줄을 수집한다', () => {
|
||||
assert.deepEqual(collectFencedLines([
|
||||
':::bookmark',
|
||||
|
||||
Reference in New Issue
Block a user