From 209b390fc992a786afe202415e2cd46d7ce5fb4e Mon Sep 17 00:00:00 2001 From: X Date: Mon, 19 Feb 2024 21:25:50 +0800 Subject: [PATCH] Update Changelog --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a19110..3b10158 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,29 @@ ## v0.1.x (current working branch) - Fix html/url escaping +- Fix code block highlighting by lines +- Add `mdToJSON` function to parse markdown to JSON (#4) + ```js + const traverse = (node) => { + // text node + if (typeof node === "string") { + console.log(node); + return; + } + + // element type + console.log(node.type); + + // element attributes (may be undefined) + console.log(node.props); + + // element children (may be undefined) + node.children?.forEach(traverse); + }; + + const tree = mdToJSON("Stay _foolish_, stay **hungry**!"); + traverse(tree); + ``` ## v0.1.0