You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently i'm using VsCode with the Markdown Preview Enhanced extension.
This allows me to integrate code chunks, meaning code snippets that are automatically executed (when saving) and produce dynamic markdown output.
Having a code execution feature would be great.
Of course in the context of a PWA, this would only be possible for Javascript code.
Example
This allows me to create dynamic calculations, such as this one
```javascript {cmd="node", hide=true output="markdown" run-on-save=true id="calcs"}
varU=3; //Voltage in VvarR=1.5; //Resistance in OhmsvarI=U/R; //Current in AmpsvarP=U*I; //Power in W```# Calc Test
This shows how dynamic calculations in Markdown can be done.
# The Data```javascript {cmd="node", hide output="markdown", run-on-save continue="calcs"}
console.log(
`|Data|Value|Unit|\n`,
`| :--: | :--: | :--: |\n`,
`|U|${U}|V|\n`,
`|I|${R}|Ω|\n`,
);
```# Calc Current
The current can be calculeted by
```javascript {cmd="node", hide output="markdown", run-on-save continue="calcs"}
console.log(
`$$`,
`I=\\frac{U}{R}`,
`=\\frac{${U.toFixed(2)}V}{${R.toFixed(2)}\\Omega}`,
`=${I.toFixed(2)}A`,
`$$`,
)
```# Calc Power
The power can be calculated by
```javascript {cmd="node", hide output="markdown", run-on-save continue="calcs"}
console.log(
`$$`,
`P= U \\cdot I`,
`= ${U.toFixed(2)}V \\cdot ${I.toFixed(2)} A`,
`=${P.toFixed(2)}W`,
`$$`,
)
```
Which produces the following output, where all the calculations dynamically adapt to the variables specified in the first JS section.
The text was updated successfully, but these errors were encountered:
Description
Currently i'm using VsCode with the Markdown Preview Enhanced extension.
This allows me to integrate code chunks, meaning code snippets that are automatically executed (when saving) and produce dynamic markdown output.
Having a code execution feature would be great.
Of course in the context of a PWA, this would only be possible for Javascript code.
Example
This allows me to create dynamic calculations, such as this one
Which produces the following output, where all the calculations dynamically adapt to the variables specified in the first JS section.

The text was updated successfully, but these errors were encountered: