Markdown examples (as used in documentation)

2.2. Markdown examples (as used in documentation)#

2.2.1. SDT#

  • {m}`function('hello','python')`: or function('hello','python') : the {m} gives a role that is a python function, defined here on the fly in the header.md, where Sphinx generates a directive a code block is then generated that allow pygments calling) A role generates a directive ``` :language: matlab ``` which is then interpreted as usual.

  • {s}`MATLAB` forces usage of class s (string command for SDT) in the HTML for coloring in the _static\sdt.css : for example MATLAB.

  • Code block

%% Step1 : Initialize model
model=struct('Node',[1 0 0 0  0   0   0;     2 0 0 0 0   0   0.15;
                     3 0 0 0  0.4 1.0 0.176; 4 0 0 0 0.4 0.9 0.176],...
             'Elt',[],'unit','SI','name','GARTEUR');
%% Step2 Fuselage
model.Elt=feutil('ObjectBeamLine 1 2',model);
model=feutil('Extrude 0  1.0 0.0 0.0',model,...
             [linspace(0,.55,5) linspace(.65,1.4,6) 1.5]);
  • Custom directives and roles (hello world level...)

Hello World Directive!

Hello World Role : <font color=”green”>test</font>

BlueColor custom role

2.2.2. Cross references#

https://myst-parser.readthedocs.io/en/latest/syntax/cross-referencing.html

Table 2.1 SDT math macros#

Insert command

Insert result

Reference command

Reference result

{{fig % ("id.png","FigID","caption")}}

_images/id.png

Fig. 2.1 caption#

{refnum}FigID   `{ref}`FigID


FigID

2.2.3. Tables#

Using pipes and -

a

b

c

\(+-\) right

left

center

\( -\) right

left

center

Using Jupyter :::

xxx need documentation

fishy

2.2.4. VScode shortcuts#

VSCode is now the preferred xxx

Preview side-by-side (Ctrl+K V) Install jupyter notbook support

python3

!"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\python.exe" -m pip install jupyter-book

Note that VSCode uses https://katex.org/docs/supported for default Math preview which is not yet compatible with SDT math macros.

2.2.5. Math#

Table 2.2 SDT math macros#

Command

Mathjax rendering

\ma{A}

\(\ma{A}\)

\mam{a & b \\ c & d}

\(\mam{a & b \\ c & d}\)

\vem{a & b \\\\ c & d}

\(\vem{a & b\\c & d}\)

\pam{a & b \\\\ c & d}

\(\pam{a & b\\c & d}\)

\ve{A}

\(\ve{A}\)

\pa{A}

\(\pa{A}\)

\pa{-\omega^2\ma{M}+j\omega\ma{C}+\ma{K}}\ve{x}=0

\(\pa{-\omega^2\ma{M}+j\omega\ma{C}+\ma{K}}\ve{x}=0\)

\diag{A}

\(\diag{A}\)

\norm{A}

\(\norm{A}\)

\su{A}

\(\su{A}\)

\du{A}

\(\du{A}\)

\oft

\(\oft\)

\ofw

\(\ofw\)

\[ w_{t+1} = (1 + r_{t+1}) s(w_t) + y_{t+1} \]

$$(my_other_label) for jupyter

Ref to equation my_other_label. Has failed;

Next