File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 11import re
22import os
3+ import shutil
34import sys
45from pathlib import Path
56
67import docutils
78from pygments .lexers import JsonLexer , XmlLexer
9+ from sphinx .ext import graphviz
810from sphinx .util import logging
911import sphinx
1012
156158 extensions += [
157159 'autodoc_placeholder' ,
158160 ]
161+ extensions .append ('sphinx.ext.graphviz' if shutil .which ('dot' ) else 'graphviz_placeholder' )
159162
160163todo_include_todos = False
161164
Original file line number Diff line number Diff line change 1+ from docutils .parsers .rst import Directive , directives
2+ from docutils import nodes
3+
4+
5+ class PlaceHolder (Directive ):
6+ """ Placeholder class for directives that must be skipped. """
7+
8+ has_content = True
9+
10+ def run (self ):
11+ node = nodes .literal_block ('graphviz' , '' )
12+ node += nodes .Text (
13+ f'{ self .content [0 ]} \n '
14+ '> Graph not rendered because `dot` is not installed'
15+ )
16+ return [node ]
17+
18+
19+ def setup (app ):
20+ directives .register_directive ('graphviz' , PlaceHolder )
21+
22+ return {
23+ 'parallel_read_safe' : True ,
24+ 'parallel_write_safe' : True
25+ }
Original file line number Diff line number Diff line change @@ -971,6 +971,13 @@ header.o_main_header {
971971 }
972972 }
973973 }
974+ .graphviz {
975+ overflow-x : auto ;
976+ white-space : nowrap ;
977+ img {
978+ max-width : unset ;
979+ }
980+ }
974981 }
975982}
976983// ------------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments