MathJax with Code Fences

Hi, I use MathJax js library for math formula and use code fences for display code. As you know \ is escape character in markdown and has special meaning in Latex. So when I write my Latex code, I must type backslash twice. I want escape area in markdown. code fences is escape area. But code fences rendered to <code>and I sytled it with CSS for displaing code not for math formula. Is there another escape area?

Hi @ghfkddorl, could you give an example of what you mean?

I am sorry for being late. I want post my code on my blog.

\begin{array}{l} \tag{2}
	& \min_{v} \nabla f^T v \\newline
	& s.t. \quad \|v\| = 1 \quad \nabla g^T v \ge 0
\end{array}

And it is example code and result of my blog. I type backslash(\) twice.

$v$ minimize bleow problem

$$ \\begin{array}{l} \\tag{2}
	& \\min\_{v} \\nabla f^T v \\newline
	& s.t. \\quad \\|v\\| = 1 \quad \\nabla g^T v \\ge 0
\\end{array} $$

and we can find $v$(return) with the code

```python
def norm_gradient_f_subject_to_g(grad):
	if grad @ w.T <= 0: return grad /np.linalg.norm(grad, ord=2)
	step_vec = grad @ mT_m
	return step_vec / np.linalg.norm(step_vec, ord=2)
```

Although, I can escape markdown rule in code fences, If I use code fences there are some style problem. first, code fences create line numbers. second, I have javascript file that emmite code info tag(top-right python decoration of the example) to div.hilight element so and I include <code> MathJax’s skipTag option.

I not want modify my javascript file and MathJax’s option and line numbers of code block is important for me :disappointed_relieved:.

Oh, I solve this problem just now. I just use simple shortcode(mytheme/layout/shortcode/formula.html)

$$ {{.Inner}} $$

and use it

{{<formula>}}
\begin{array}{l} \tag{2}
	& \min_{v} \nabla f^T v \newline
	& s.t. \quad \|v\| = 1 \quad \nabla g^T v \ge 0
\end{array}
{{</formula>}}

and result

:smile: shortcode inner value escape markdown rule.