答案1
对于 docker-compose YAML,我需要实现类似的结果,但无法立即找到答案。无论如何,这是一种可以让你实现类似于所需结果的方法:
- 定义类似于以下内容的自定义语言
\usepackage{listingsutf8}
\usepackage[usenames]{color}
\usepackage{xcolor}
\lstdefinelanguage{my-yaml}{
keywords={spec, containers, name}, % ,... all the keyword you want
keywordstyle=\color{blue}\bfseries,
moredelim=[is][commentstyle]{||}{££}, % invisible custom delimiters
identifierstyle=\color{black},
sensitive=false,
comment=[l]{\#},
commentstyle=\color{olive}\ttfamily,
stringstyle=\color{orange}\ttfamily,
morestring=[b]',
morestring=[b]"
}
- 使用方法如下
\begin{lstlisting}[language=my-yaml,caption={Docker Compose YAML composing the various containers of the setup together.},numbers=left]
spec:
containers:
- name: ||test££
\end{lstlisting}