gpoore / codebraid

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

Workflow Suggestions #9

Closed amichuda closed 4 years ago

amichuda commented 5 years ago

Just wanted to get your thoughts on how you use codebraid for your work.

My current workflow is to write the markdown in VSCode and then run the codebraid command every time I want a new version of my document but it's a bit cumbersome.

What's your set up when you write with codebraid? Do you have any recommendations on software?

gpoore commented 5 years ago

For my last longer document, I created a simple build script. Running the script would open my document in VSCode, open the PDF output in a PDF viewer (I was using Codebraid as a LaTeX replacement), and then watch for modifications to the document files. Any modifications cause codebraid to run. I was pretty happy with how that worked, though it would be nice to have something like an extension for VSCode that would automatically open output and rebuild on save.

For me, the main current workflow limitation is the lack of preview sync between Markdown and the output. The features needed to track a line of Markdown into a final location in output are mostly already in place. The next step will be adding sync tags to HTML output and synctex support for LaTeX, and figuring out how to integrate that with editors.

amichuda commented 5 years ago

That's a great suggestion! I wrote up a basic script with inotify and it works pretty well.

A vscode extension would be awesome, or at least to have markdown code fencing give python syntax highlighting when writing {.python

amichuda commented 5 years ago

I made a pull request to the vscode grammar so that all supported codebraid languages would have syntax highlighting:

microsoft/vscode-markdown-tm-grammar/pull/57

You can use my fork if you want with those changes already made:

https://github.com/lordflaron/vscode-markdown-tm-grammar

gpoore commented 5 years ago

Syntax highlighting would be great. It might be worth mentioning in your pull request that this syntax isn't unique to Codebraid. Codebraid just uses Pandoc Markdown, so really what you're requesting is support for Pandoc Markdown (https://pandoc.org/MANUAL.html#fenced-code-blocks).

For general Pandoc Markdown support (not just limited to the languages Codebraid currently supports, which is actually a large number given Jupyter kernels), I think you could just replace all the (`{3,}|~{3,})\s* (except for the last occurrence, which is for unknown languages) with something like (`{3,}|~{3,})\s*(?:\{\s*\.)? in the grammar. This wouldn't cover the case of Pandoc's ```{#id .language} syntax, but that probably won't be that common anyway, and having any support would be a major improvement.

amichuda commented 5 years ago

Yes! That seems to make sense, but the grammar file had all those languages separately so I decided to go along with their format. I'm new to pull requests (as well this textmate language grammar stuff) so I'm not sure what's considered appropriate.

In regards to the jupyter kernel support man oh man is that nice. I just used the Stata kernel and it works perfectly on it. Especially since you can define separate sessions and have multiple kernels running for one document.

I want to say thank you again for the great work!

On Thu, Aug 29, 2019, 9:46 AM Geoffrey Poore notifications@github.com wrote:

Syntax highlighting would be great. It might be worth mentioning in your pull request https://github.com/microsoft/vscode-markdown-tm-grammar/pull/57/ that this syntax isn't unique to Codebraid. Codebraid just uses Pandoc Markdown, so really what you're requesting is support for Pandoc Markdown ( https://pandoc.org/MANUAL.html#fenced-code-blocks).

For general Pandoc Markdown support (not just limited to the languages Codebraid currently supports, which is actually a large number given Jupyter kernels), I think you could just replace all the ({3,}|~{3,})\s* (except for the last occurrence, which is for unknown languages) with something like ({3,}|~{3,})\s(?:{\s.)? in the grammar. This wouldn't cover the case of Pandoc's ```{#id .language} syntax, but that probably won't be that common anyway, and having any support would be a major improvement.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gpoore/codebraid/issues/9?email_source=notifications&email_token=ABQVPBFW36GIDWOBV4FF43TQG74NJA5CNFSM4IQ7424KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5PDVNY#issuecomment-526269111, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQVPBDPXE2KJRY4TYNHFPDQG74NJANCNFSM4IQ7424A .