如何在Asciidoctor Asciidoc中转义双加号“ ++”?

问题描述

例如,如果我写:

Notepad++ is *great*,I like Notepad++

它将++something++视为转义结构,而忽略*粗体并产生:

<p>Notepad is *great*,I like Notepad</p>

而不是期望的:

<p>Notepad++ is <strong>great</strong>,I like Notepad++</p>

上游讨论:https://github.com/asciidoctor/asciidoctor/issues/1864

asciidoctor 2.0.10上进行了测试。

解决方法

一些可以满足我需求的选项:

Notepadpass:[++] is *great*,I like Notepadpass:[++]

Notepad{blank}pass:[++] is *great*,I like Notepad{blank}pass:[++]

Notepad{plus}{plus} is *great*,I like Notepad{plus}{plus}

我不确定100%Notepadpass:[++]是否仅出于意外目的。我想我只是和{plus}{plus}一起去。

{plus}记录在https://asciidoctor.org/docs/user-manual/#charref-attributes

对于C++的特定情况,还有{cpp}

,

另一种选择是使用反斜杠转义第一个NLog.config

var logDir = "var/log/my-app";
NLog.GlobalDiagnosticsContext.Set("LogDir",logDir);
NLog.Common.InternalLogger.LogFile = System.IO.Path.Combine(logDir,"internal.txt");

这在其他格式上也是如此。