breaks()
將文字中的換行轉換為 `<br>` 元素。
import { breaks } from "@unifast/node";函式簽名
function breaks(): UnifastPlugin參數
無。
用法
import { compile, breaks } from "@unifast/node";
const md = `This is line one.
This is line two.
This is line three.`;
const result = compile(md, {
plugins: [breaks()],
});
// Each newline becomes a <br> element範例
將換行轉為換行元素
若未啟用 breaks(),這三行會合併成單一段落。啟用此外掛後,每個換行都會變成 <br>: