Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

markdown parser drops important information causing asymmetric read/write #22

Open
timothypratley opened this issue Jan 5, 2024 · 2 comments · May be fixed by #6
Open

markdown parser drops important information causing asymmetric read/write #22

timothypratley opened this issue Jan 5, 2024 · 2 comments · May be fixed by #6

Comments

@timothypratley
Copy link

Given an input markdown file, important information is lost

(def text (slurp "md/try-again.md"))
(def doc (md/parse text))
(def result (mdt/->text doc))
(spit "md/try-again2.md" result)

(deftest ttt
  (is (= result text)))
;=> fail
  1. HTML tagged sections are removed
  2. The original text is not preserved (only the content)

It would be useful to preserve the original text (for the same reasons clj-rewrite exists).

I'm trying to convert a Markdown file into a Clojure namespace by just putting comments around everything that is not code, and stripping the blocks around the code, but reproducing the Markdown is not straight forward.

@zampino zampino linked a pull request Jan 6, 2024 that will close this issue
@zampino
Copy link
Collaborator

zampino commented Jan 6, 2024

The purpose of n.m.transform/->text is not to rebuild the markdown syntax behind a node.

There's been some work to do the conversion from data back to markdown text that I'd like to resume at some point. Thanks for the reminder :-).

I'm trying to convert a Markdown file into a Clojure namespace

That's covered in a notebook based on the above pr and could possibly land into Clerk in the future.

@timothypratley
Copy link
Author

Thank you @zampino

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 a pull request may close this issue.

2 participants