- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.8k
 
Open
Labels
Description
Problem
When including code files via .. include they are rendered as one long line, instead of the expected block.
Reproducible Project
Compare:
External file main.cpp
#include <stdio>
int main()
{
  std::cout << "hello\n";
  return 0;
}.. include:: main.cpp
  :code: cpp
  :number-lines:versus
.. code:: cpp
  #include <stdio>
  int main()
  {
    std::cout << "hello\n";
    return 0;
  }Error Logs/Results
The difference between included code and code blocks in the html are:
- included: 
<pre class="code cpp literal-block"><code>...content..</code></pre> - code block: 
<div class="highlight-cpp notranslate"><div class="highlight"><pre>..content..</pre></div></div> 
Additionally included blocks use different CSS classes for highlighting. For example:
- included: 
literal scalar plain - code block: 
l l-Scalar l-Scalar-Plain 
In summary this seems to create a bit of unnecessary duplicates for the style sheets.
Expected Results
included code and code blocks should look the same.
Environment Info
(virtualenv on debian stretch)
- Python Version: 3.5.3
 - Sphinx Version: 2.4.4
 - docutils Version: 0.16
 - RTD Theme Version: 0.4.3
 - Browser: Firefox 68.8.0esr