UNPKG

yaml-unist-parser

Version:

A YAML parser that produces output compatible with unist

11 lines (10 loc) 480 B
import { createPlain } from "../factories/plain.js"; import { findLastCharIndex } from "../utils/find-last-char-index.js"; export function transformPlain(plain, context) { const cstNode = plain.cstNode; return createPlain(context.transformRange({ origStart: cstNode.valueRange.origStart, origEnd: findLastCharIndex(context.text, cstNode.valueRange.origEnd - 1, /\S/) + 1, }), context.transformContent(plain), cstNode.strValue); }