What is the point of the Sphinx highlight_language config option if code-block:: doesn't have an optional argument?
It says that it sets the default hightlight_language, but if every time that you specify code you need to state the language, why does it need the config option?
Am I doing something wrong?
Edit: From the logs when I remove the argument for codeblock.
C:\c\Sponge\SpongeDocs\source\plugin\scheduler.rst:25: ERROR: Error in "code-block" directive:
1 argument(s) required, 0 supplied.
.. code-block::
taskBuilder.execute(new Runnable() {
public void run() {
logger.info("Yay! Schedulers!");
}
});
Documentation is a little bit vague here. In fact ..code-block::
directive should only be used if you want to specify language explicitly for some reason. For default you should use a simple ::
block:
Examples of Python source code or interactive sessions are represented using standard reST literal blocks. They are started by a
::
at the end of the preceding paragraph and delimited by indentation.
(Source: http://www.sphinx-doc.org/en/stable/markup/code.html)
It will look like this:
::
var hello = "Hello, World!";
console.log(hello);
When using the code-block::
directive, specifying the language is optional.
As explained in the documentation, the default language highlighting is for python. With setting the highlight_language
, you can change this, e.g. to have c code highlighting when using a code-block::
without specifying a language.
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