![重新定义 markdown 中的 quote 后,如何恢复到其初始定义?该定义未知或可能因风格而异](https://linux22.com/image/447139/%E9%87%8D%E6%96%B0%E5%AE%9A%E4%B9%89%20markdown%20%E4%B8%AD%E7%9A%84%20quote%20%E5%90%8E%EF%BC%8C%E5%A6%82%E4%BD%95%E6%81%A2%E5%A4%8D%E5%88%B0%E5%85%B6%E5%88%9D%E5%A7%8B%E5%AE%9A%E4%B9%89%EF%BC%9F%E8%AF%A5%E5%AE%9A%E4%B9%89%E6%9C%AA%E7%9F%A5%E6%88%96%E5%8F%AF%E8%83%BD%E5%9B%A0%E9%A3%8E%E6%A0%BC%E8%80%8C%E5%BC%82.png)
quote
在 markdown 中重新定义创建具有背景颜色和边框的漂亮块引用之后,我该如何返回到之前的quote
定义,
这是未知的,因为 markdown 首先初始化了它,而我不知道如何、用什么?
这里是pdf显示我遇到的问题:我决定在块引用上放置一个带边框的绿色背景,然后当我决定这样做时,我无法完全删除这个背景和边框……
我没有办法确保回到以前的状态。
这pdf紧接着是生成它的 markdown 文件。
---
header-includes:
- \usepackage{tcolorbox}
- \usepackage{fvextra}
geometry: margin=2cm
fontsize: 12pt
output: pdf
classoption: fleqn
---
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,breakanywhere,breaksymbol=,breakanywheresymbolpre=,commandchars=\\\{\}}
\newcommand{\cadreAvantage}{\renewtcolorbox{quote}{colback=green!5!white,arc=0pt,outer arc=0pt,colframe=green!75!black,code={\tcbset{enlarge left by=1cm}}}}
\newcommand{\cadreAttention}{\renewtcolorbox{quote}{colback=orange!5!white,arc=0pt,outer arc=0pt,colframe=orange!80!black,code={\tcbset{enlarge left by=1cm}}}}
\newcommand{\cadreTransparent}{\renewtcolorbox{quote}{colback=white!5!white,arc=0pt,outer arc=0pt,boxrule=0pt,lowerbox=invisible,code={\tcbset{enlarge left by=1cm}}}}
I begin a text, and then do a blockquote `> ....`
> Here a normal blockquote: I don't know how _markdown_ defines it
> it's the classical one, without border, nothing: only a left padding
Then, I wish to put some text under a green blockquote
\cadreAvantage
> This blockquote will be more visible
> Nice green, it is really attractive
But how to go back to the previous blockquote shape, the one that comes with markdown?
> If a do another blockquote without changing anything, its still green
Defining `quote` to nothing with a `\renewtcolorbox{quote}{}` doesn't return to normal:
> I have cancelled `quote` definition here
> It's grey...
I have a workaround : defining a transparent blockquote
\cadreTransparent
> But it still have borders, I cannot remove them,
> and its not really what previously existed.
How may I rollback `quote` to its previous definition?
considering that I don't really know what it was, only markdown knows how it initialized `quote` (it might even depend even on your operating system, distro, environment flavor...)
so that they will look as if I'd never changed them...
\cadreAttention
> Until I decide doing so again?
I believe that I don't really need to know what this initial definition is.
I think (but you might have a better idea) that what I need is to be able to save it once, and to restore it each time its needed.
So that I will have command in my markdown like:
/saveQuote
abc
/cadreAvantage
> def
/restoreQuote
jkl
/cadreAttention
> mno
/restoreQuote
> this one is the normal blockquote
(该pdf文件是由pandoc -f markdown-implicit_figures test.md -o test.pdf
命令创建的)。
答案1
您可以quote
通过以下方式保护环境:
\let\oldQuote\quote
\let\endoldQuote\endquote
并使用以下命令恢复:
\let\quote\oldQuote
\let\endquote\endoldQuote
---
header-includes:
- \usepackage{tcolorbox}
- \usepackage{fvextra}
- \let\oldQuote\quote \let\endoldQuote\endquote
- \newcommand{\restoreQuote}{\let\quote\oldQuote \let\endquote\endoldQuote}
- \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,breakanywhere,breaksymbol=,breakanywheresymbolpre=,commandchars=\\\{\}}
- \newcommand{\cadreAvantage}{\renewtcolorbox{quote}{colback=green!5!white,arc=0pt,outer arc=0pt,colframe=green!75!black,code={\tcbset{enlarge left by=1cm}}}}
- \newcommand{\cadreAttention}{\renewtcolorbox{quote}{colback=orange!5!white,arc=0pt,outer arc=0pt,colframe=orange!80!black,code={\tcbset{enlarge left by=1cm}}}}
- \newcommand{\cadreTransparent}{\renewtcolorbox{quote}{colback=white!5!white,arc=0pt,outer arc=0pt,boxrule=0pt,lowerbox=invisible,code={\tcbset{enlarge left by=1cm}}}}
geometry: margin=2cm
fontsize: 12pt
output: pdf
classoption: fleqn
---
I begin a text, and then do a blockquote `> ....`
> Here a normal blockquote: I don't know how _markdown_ defines it
> it's the classical one, without border, nothing: only a left padding
Then, I wish to put some text under a green blockquote
\cadreAvantage
> This blockquote will be more visible
> Nice green, it is really attractive
But how to go back to the previous blockquote shape, the one that comes with markdown?
> If a do another blockquote without changing anything, its still green
Defining `quote` to nothing with a `\renewtcolorbox{quote}{}` doesn't return to normal:
> I have cancelled `quote` definition here
> It's grey...
I have a workaround : defining a transparent blockquote
\cadreTransparent
> But it still have borders, I cannot remove them,
> and its not really what previously existed.
How may I rollback `quote` to its previous definition?
considering that I don't really know what it was, only markdown knows how it initialized `quote` (it might even depend even on your operating system, distro, environment flavor...)
so that they will look as if I'd never changed them...
\cadreAttention
> Until I decide doing so again?
I believe that I don't really need to know what this initial definition is.
I think (but you might have a better idea) that what I need is to be able to save it once, and to restore it each time its needed.
So that I will have command in my markdown like:
> ``` abc
>
> \cadreAvantage
>
> > def
>
> \restoreQuote
>
> jkl
>
> \cadreAttention
>
> > mno
>
> \restoreQuote
>
> > this one is the normal blockquote ```
>
> abc
>
> \cadreAvantage
>
> > def
>
> \restoreQuote
>
> jkl
>
> \cadreAttention
>
> > mno
>
> \restoreQuote
>
> > this one is the normal blockquote