Skip to content

markdownRendererInputFencedCode + minted package #485

Answered by l0th3r
l0th3r asked this question in Q&A
Discussion options

You must be logged in to vote

Answer

After @Witiko 's help.
Now the renderer override \markdownRendererInputFencedCode will use the minted package only if the fenced block "title" is present, using it as a language for the minted package while using our own environment to wrap the style of the fenced code bloc.

main.tex:

% Create a new environement "codeblock"
\newtcolorbox{codeblock}[2][]{
title={#2},
fonttitle=\scriptsize,
leftrule=1mm,
rightrule=0mm,
toprule=0mm,
bottomrule=0mm,
arc=0mm,
#1}

% Override the renderer of fenced code blocs
\ExplSyntaxOn% enable LaTex3 syntax
\global\def\markdownRendererInputFencedCode#1#2#3{%
	\catcode`\#=6\relax
	\begin{codeblock}{ #2 }
		\tl_if_empty:nTF
		{ #2 }% if the second argu…

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
10 replies
@l0th3r
Comment options

@Witiko
Comment options

@l0th3r
Comment options

@Witiko
Comment options

@l0th3r
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by l0th3r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants