gpoore / codebraid

Live code in Pandoc Markdown
BSD 3-Clause "New" or "Revised" License
367 stars 13 forks source link

Question about removing extraneous markdown characters from output #55

Closed 00krishna closed 2 years ago

00krishna commented 2 years ago

@gpoore thanks again for creating codebraid with your collaborators. After the answers to my initial issues, things are working pretty well.

I was just wondering if you had a suggestion for this small issue. I am using codebraid to generate documents--with code and plots--for a Hugo blog. The markdown output from codebraid works very well, but there are some additional tags or notations in the markdown files that should be removed before being sent to Hugo. For example, there are tags like: ::: exampleOutput, {.python .numberLines startFrom="1"}, {.richOutput}, and other similar notations.

Now I could write some simple text processing code and filter out these extra notations. But, I was wondering if you know any better ways to remove these notations? You certainly know all these tools better than I do. I am not sure if there are some options in codebraid to remove these extra notations. OR, perhaps I could use original pandoc itself to post-process the codebraid output and remove these notations?

I saw that you created that minimal example for the "Make the Docs" site, which is similar to Hugo. Did you find a good way to remove those extra notations in the markdown files before pushing those files to the "Make the Docs" content folders? Just wondering, and asking for advice. Thanks.

gpoore commented 2 years ago

All of that is Markdown syntax additions from Pandoc's Markdown or commonmark_x. For Hugo, you probably want to convert your documents to GitHub-flavored Markdown, so use --to gfm. When Pandoc exports --to markdown, that is Pandoc's Markdown, with all the syntax additions.

00krishna commented 2 years ago

Ahhh, that is brilliant. Okay, I get you now. I will give that a try. Thanks so much for that tip. I would have spent the next couple of days writing all sorts of regular expressions and stuff to remove those notations :).