Is there any way to apply formatting inside a code block in pandoc markdown? As an example, consider the following:
```cpp
void foo() noexcept(*see below*);
```
I'd like the "see below" part to be italicized inside the code block - however the *
characters appear verbatim in the result. I've also tried using <i>
HTML tags, with the same result.
Is there any solution to this problem that does not require postprocessing of the generated document?
Codes Blocks uses Google's Apps Script, a server-side JavaScript platform, to interact with Docs and format code. Each time the add-on formats a snippet of code, a request is made to the Apps Script backend to modify the current Doc.
Pandoc uses LaTeX per default for PDF generation, so it depends on your TeX installation. If you're on TeX Live you can use all in this font catalogue.
Background. Pandoc's markdown lets you specify extensions for how you would like your markdown to be handled: Markdown syntax extensions can be individually enabled or disabled by appending +EXTENSION or -EXTENSION to the format name.
The basic Markdown syntax allows you to create code blocks by indenting lines by four spaces or one tab. If you find that inconvenient, try using fenced code blocks. Depending on your Markdown processor or editor, you'll use three backticks ( ``` ) or three tildes ( ~~~ ) on the lines before and after the code block.
You cannot control formatting inside code blocks at this arbitrary level where you decide yourself which parts to italize and which not. Code block is code block which means that the content is rendered verbatim.
However, you can apply a syntax highlighter to code blocks. A syntax highlighter has some knowledge about programming languages and can identify keywords and idiomatic parts to apply its own rules to these inside code blocks.
To see which syntax highlight styles are available for your version of Pandoc, run:
pandoc --list-highlight-styles
On this system the highlighters are: espresso, haddock, kate, monochrome, pygments, tango, zenburn
.
To see which languages the highlighters can handle, run:
pandoc --list-highlight-languages
My Pandoc spits out a list of 141 languages. cpp
is amongst them.
I created sample results from your code snippet (without the **) for all styles and put them into a JPEG below. From top to bottom: espresso, haddock, kate, monochrome, pygments, tango, zenburn. As you can see, the two words you wanted are not highlighted, but some hey words and key syntax elements of CPP are:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With