Example of working through MyST port of the book#165
Example of working through MyST port of the book#165rowanc1 wants to merge 1 commit intoresampling-stats:mainfrom
Conversation
|
Thanks, @rowanc1! |
rowanc1
left a comment
There was a problem hiding this comment.
A few callouts on the differences.
| *.blg | ||
| *_bibertool.bib | ||
| _bookdown.yml | ||
| *.md |
There was a problem hiding this comment.
We probably need to read .rmd but at this time only read .md files.
| plugins: | ||
| - plugin.mjs |
There was a problem hiding this comment.
We are adding some plugins here in an mjs file!
| import { fileError, liftChildren, NotebookCell } from 'myst-common'; | ||
| import { remove } from 'unist-util-remove'; | ||
|
|
||
| const MODE = 'python'; |
There was a problem hiding this comment.
This likely will be an env variable so that you can MODE = "python" && myst start or similar.
| const PYTHON_VARS = { | ||
| lang: 'Python', | ||
| np_or_r: 'NumPy', | ||
| other_lang: 'R', |
There was a problem hiding this comment.
We are bringing this in to Javascript at the moment, but this could read from your existing variables, just being lazy to hack trhough a proof of concept.
| const varShortCode = { | ||
| name: 'var', | ||
| body: { | ||
| type: String, | ||
| required: true, | ||
| }, | ||
| run(data, vfile) { | ||
| const replacement = PYTHON_VARS[data.body]; | ||
| if (!replacement) { | ||
| fileError(vfile, `shortcode: "var", unknown replacement "${data.body}"`, { node: data.node }); | ||
| return; | ||
| } | ||
| if (typeof replacement === 'string') { | ||
| return [{ type: 'text', value: replacement }]; | ||
| } | ||
| return replacement; | ||
| }, | ||
| }; |
There was a problem hiding this comment.
This is the var short code plugin. This requires a branch in mystmd, which adds some markup parsing.
|
|
||
| ```{r fig-round_ndigits_pl, opts.label='svg_fig', fig.cap="`round` with optional arguments specifying number of digits"} | ||
| include_svg('diagrams/round_function_ndigits_pl.svg') | ||
| ```{figure} diagrams/round_function_ndigits_pl.svg | ||
| :label: fig-round_ndigits_pl | ||
| :width: 50% | ||
| `round` with optional arguments specifying number of digits | ||
| ``` |
There was a problem hiding this comment.
This is the biggest change, these, as far as I can tell, are just figures?
| We can apply the same operation on `q` to count the number of {{< var true | ||
| >}} values. | ||
|
|
||
| > }} values. |
There was a problem hiding this comment.
Hm, this is wrong, shouldn't be a blockquote!
| ::: {.callout-note} | ||
| ::: Python | ||
| :::: {.callout-note} | ||
| ::: python |
There was a problem hiding this comment.
The ::: fence is treated a bit different. They need to be larger number of colons on the outside and they currently need to match the number on the closing of the fence.
| :::::: | ||
| :::: |
There was a problem hiding this comment.
This is again, a bit of a different treatment.
|
|
||
| To do this, we make {{< var an_array >}} called `z` to hold the | ||
| 100 counts. We have called the {{< var array >}} `z`, but we could have | ||
| 100 counts. We have called the {{< var array >}} `z`, but we could have |






@stefanv the diff is very large at the moment. My formatter did some opinionated changes that I wasn't that careful about, I think the changes are actually quite small. I will make a review to call things out.
This is dependent on the branch in mystmd here:
https://github.com/executablebooks/mystmd/tree/feat/parser