What is the point of the Sphinx highlight_language configuration option if the block code :: does not have an optional argument?

What is the meaning of the Sphinx highlight_language configuration options if code-block :: does not have an optional argument?

It says that it sets hightlight_language by default, but if every time you specify the code, you need to specify the language, why does it need a configuration parameter?

Am I doing something wrong?

Edit: From the logs when I remove the argument for the code block.

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!"); } }); 
+6
source share
2 answers

The documentation here is a bit vague. In fact, the ..code-block:: directive should only be used if you want to explicitly specify the language for any reason. By default, you should use a simple block ::

Examples of Python source code or interactive sessions are presented using standard REST block literals. They begin with the :: symbol at the end of the previous paragraph and are limited to indentation.

(Source: http://www.sphinx-doc.org/en/stable/markup/code.html )

It will look like this:

 :: var hello = "Hello, World!"; console.log(hello); 
+4
source

When using the code-block:: directive, language specification is optional.

As explained in the documentation , default allocation for python. With setting highlight_language you can change this, for example. to highlight c-code when using code-block:: without specifying a language.

+1
source

All Articles