Open
Conversation
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

I was looking for a way to edit specific sections in my Obsidian files. For example, I keep journals in daily notes und er the "# Journal" section. I have some journal entries from other sources and I wanted a way to easily insert these entries into my "# Journal" section as a subsection.
I thought some kind tree-like format would work well for this, but most markdown libraries only converted one-way to HTML. I needed to convert back to markdown once I'd edited the tree-like version of the file.
So instead I implemented a bidirectional converter from Markdown to XML. It doesn't do anything fancy, just builds a tree of all the sections in the markdown files by looking at the number of "#" in front of a header.
I added plenty of tests for all the code possible cases I could think of.
Let me know what you think. I'm fine with moving the code around for better organization, but wanted y'all to look at it first.