Masked Man
Masked Man

Reputation: 11015

doxygen markdown prevent syntax highlighting in fenced code block

I want a fenced code block to appear without any syntax highlighting. For the following code:

~~~
Behold this, for this is an orange.
~~~

I get for and this in color. Notice I have not specified the file extension. Do I need to specify a specific extension? I tried with {.txt}, but that didn't help.

Upvotes: 3

Views: 3105

Answers (4)

PeterErnsthaft
PeterErnsthaft

Reputation: 395

with current versions of doxygen (i used 1.8.13) using the ~~~-syntax without language specification produces a code block without syntax highlighting. Common language specifications are

  • ~~~{.cpp} (C++)
  • ~~~{.c} (C)
  • ~~~{.py} (python)

Upvotes: 2

the swine
the swine

Reputation: 11031

You can try to mimic the styles that doxygen uses, which is done like this:

/**
 * <div class="fragment">
 * <div class="line">Behold this, for this is an orange.</div>
 * <div class="line">General use:</div>
 * <div class="line">   ./SLAM_plus_plus -i <filename> --no-detailed-timing</div>
 * <div class="line"></div>
 * <div class="line">To run the pose-only datasets more quickly:</div>
 * <div class="line">   ./SLAM_plus_plus -i <filename> --pose-only --no-detailed-timing</div>
 * <div class="line"></div>
 * <div class="line">To run incrementally:</div>
 * <div class="line">   ./SLAM_plus_plus -nsp <optimize-each-N-verts> -fL -i <filename> --no-detailed-timing</div>
 * </div>
 */

While a bit elaborate (each line of text needs to be surrounded by its own <div>), it will get you what you want, with no highlighting. You might want to surroung this block with \htmlonly and \endhtmlonly to avoid whitespace condensation (otherwise sequences of multiple tabs / spaces are replaced by a single space by Doxygen - tweaking css will not help).

Alternately, you can use some more obscure language such as {.f} or {.vhdl} which Doxygen knows but which does not have keywords occurring in your text too much.

Upvotes: 0

DanChianucci
DanChianucci

Reputation: 1175

You have a couple of options here.

  • can use <pre> </pre> block. What ever is inside will be left displayed in a monospace font like a console.

  • You can use the <blockquote> </blockquote> which indents and places a vertical blue line to the left.
    • alternatively you can use markdown and place a '>' and then a space before the text you want to show as output.

Upvotes: 3

DRH
DRH

Reputation: 8288

Doxygen will apply syntax highlighting to a fenced code block based on either an explicit language ({.cpp}) or on the implicit language (the language of the code currently being parsed). If the language is not recognized, It appears to assume C/C++ syntax highlighting rules.

Unfortunately, this means that the code will be formatted according to one of the languages supported by Doxygen, and there isn't a way to trick it into displaying the fenced code block without syntax highlighting.

Upvotes: 2

Related Questions