'Markdown: Math-environments inside code block

Some markdown engines support mathematic expressions (= LaTeX) by wrapping them in $-signs. When writing pseudo code, it would be practical to also have them inside of the code environment like this:

```
foreach $u \in V$ do
  u.d = $\infty$
```

Is there a way to escape the code block, so that those math-expressions do render?



Solution 1:[1]

You can either set your font to a monospaced alternative and remove the block wrapper, or use in-line code wrappers around your mathematical expressions.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 M.H. Tajaddini