Skip to content

Feature to convert markdown file to xml#12

Open
abhmul wants to merge 2 commits intodanymat:mainfrom
abhmul:abhmul.markdown-to-xml
Open

Feature to convert markdown file to xml#12
abhmul wants to merge 2 commits intodanymat:mainfrom
abhmul:abhmul.markdown-to-xml

Conversation

@abhmul
Copy link

@abhmul abhmul commented Aug 30, 2021

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.

@abhmul
Copy link
Author

abhmul commented Aug 30, 2021

image

It looks like Git is not checking the tests, so here is proof that all tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant