-
Notifications
You must be signed in to change notification settings - Fork 297
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
Python Markdown extension for VS Code #1655
Comments
Thanks for the suggestion! We'll look into it. |
Markdown for Data Science Within RStudio these "fenced_code_blocks" have flags for behavior such as whether to run and replace with output (eval=True) and whether to display source code ( echo=False). When turning in homework for Coursera Data Science we were admonished like math class to "show all our work" which meant displaying all of the source code with "echo=True"). More generally, depending on the audience, the audience may or may not care how the sausage was made. The code block superset of Pandoc markdown behavior seems to be run by the R package knitR. So, for data science, it would be helpful in VS Code to have Pandoc compatible markdown with "fenced_code_blocks" reprocessed by a language pre-processor/interpreter which in the case of R would be the knitR package/R interpreter. I don't know if their is an equivalent of knitR for Python. An "R-centric" way of handling Python would be to using the R knitR and reticulate packages. It is not clear what the "Python engine for R Markdown" is but there are some clues as to how it must be installed in the R Reticulate package. Here is the GitHub for Reticulate Reticulate is just the R/Python interface, the pluggable engines seems to be provided by the knitR package; specifically knitR's "knit_engines" object: "knit_engines: Engines of other languages
https://rstudio.github.io/reticulate/articles/r_markdown.html NOTE: "RScript" is R so it is not clear how R is being handled. So, from a data science perspective the VS Code handling of markdown needs to:
Implementing the feature this way would greatly reduce "RStudio envy".
|
NOTES ON PANDOC "Pandoc is a Haskell library for converting from one markup format to another, and a Although I learned about Pandoc as a tool for final conversion of R Markdown to a variety of formats; Pandoc is much more powerful; for example Pandoc can read and write both Microsoft Word and Jupyter Notebooks!!! And Pandoc can output to Microsoft PowerPoint. |
Reproducible Research (motivation for R Markdown) British Ecological Society The British Ecological Society Guide is compatible with the Coursera / Johns Hopkins University "Reproducible Research" course but more concise. |
pandoc-plot is a custom filter for Pandoc to include graphics (graphical library oriented) rather than language oriented (as in knitR). |
nbconvert |
John G. MacFarlane (jgm) in addition to being the author of Pandoc is a co-author of the markdown specification, "CommonMark Spec" and the JavaScript reference implementation of CommonMark specification, commonmark.js (and there is also a Python port of commonmark.js called commonmark.py). CommonMark Spec (fenced-code-block) The line with the opening code fence may optionally contain some text following the code fence; this is trimmed of leading and trailing whitespace and called the info string. CommonMark Spec (info-string) Pandoc User's Guide (Pandoc's Markdown) Extension: fenced_code_attributes [reduced number of tildas below three so GitHub won't render away markdown -- jbc] ~~ {#mycode .haskell .numberLines startFrom="100"} RStudio uses an ".rmd" extension for "RMarkdown" and pre-processes with R KnitR package commonmark.js (reference implementation of CommonMark Specification) commonmark.py (port of commonmark.js to Python) |
Just to clarify for readers of this thread; VS Code already supports Markdown:
The VS Code Markdown functionality is hidden until you actually create or open a file with the ".md" extension and then magic happens! In the VS code "command pallet" there are markdown commands; including "Markdown: Open Preview to the Side". This is awesome, while your markdown tab stays open; a new tab previewing the formatted output is opened to the right. It is not that the screen setup is that unusual, but that it is so easy to get to! I went from not being able to find the markdown commands in VS Code to having this beautiful side by side view in seconds. If you haven't tried Markdown in VS Code, this is really easy!
Try it. BTW, in the VS Code Help, "Markdown" is listed as a language (among C and Python) and is where the above quote came from. What we are asking for is implementing executable code blocks within Markdown like there are for Python in Jupyter Notebooks or for R in RStudio. |
"The Markdown Preview Mermaid Support extension demonstrates using scripts to add mermaid diagrams and flowchart support to the markdown preview. You can review the Mermaid extension's source code on GitHub." The VS Code "Mermaid" extension uses a three back tick (```) code block; so it may serve as a model for programming language code blocks {reduced to two backticks to prevent rendering): ```mermaidgraph LR ```https://marketplace.visualstudio.com/items?itemName=bierner.markdown-mermaid Mermaid extension GitHub Mermaid seems to link to markdown-it Interesting comment in The handling of the Julia .jmd extension sounds nearly identical to the way one would handle the R .rmd extension. |
Having a vscode handler for The big advantages of editing notebooks in
I'm very happy to expand if that's of interest - but only to say that adding this feature would be a big step in usability and teachability for notebooks. |
Marking this as dupe of #4946 which has more upvotes |
Feature Request: "Python Markdown" in Markdown cells
Description
It would be nice to have the equivalent of the "Python Markdown" extension for Jupyter in VS Code. So within a markdown cell, you could put arbitrary Python code between two curly braces which would be executed and rendered in-line. This is very useful when writing quantitative scientific reports.
Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer
The text was updated successfully, but these errors were encountered: