1010from sphinx .util .nodes import nested_parse_with_titles
1111
1212from sphinxarg .parser import parse_parser , parser_navigate
13- from sphinxarg .markdown import parseMarkDownBlock
1413
1514
1615def map_nested_definitions (nested_content ):
@@ -58,6 +57,7 @@ def renderList(l, markDownHelp, settings=None):
5857 if len (l ) == 0 :
5958 return []
6059 if markDownHelp :
60+ from sphinxarg .markdown import parseMarkDownBlock
6161 return parseMarkDownBlock ('\n \n ' .join (l ) + '\n ' )
6262 else :
6363 if settings is None :
@@ -151,7 +151,7 @@ def print_action_groups(data, nested_content, markDownHelp=False, settings=None)
151151 return nodes_list
152152
153153
154- def print_subcommands (data , nested_content , markDownHelp = False ):
154+ def print_subcommands (data , nested_content , markDownHelp = False , settings = None ):
155155 """
156156 Each subcommand is a dictionary with the following keys:
157157
@@ -192,10 +192,12 @@ def print_subcommands(data, nested_content, markDownHelp=False):
192192 for element in renderList (desc , markDownHelp ):
193193 sec += element
194194 sec += nodes .literal_block (text = child ['bare_usage' ])
195- for x in print_action_groups (child , nested_content + subContent , markDownHelp ):
195+ for x in print_action_groups (child , nested_content + subContent , markDownHelp ,
196+ settings = settings ):
196197 sec += x
197198
198- for x in print_subcommands (child , nested_content + subContent , markDownHelp ):
199+ for x in print_subcommands (child , nested_content + subContent , markDownHelp ,
200+ settings = settings ):
199201 sec += x
200202
201203 subCommands += sec
@@ -457,6 +459,7 @@ def run(self):
457459 items = []
458460 nested_content = nodes .paragraph ()
459461 if 'markdown' in self .options :
462+ from sphinxarg .markdown import parseMarkDownBlock
460463 items .extend (parseMarkDownBlock ('\n ' .join (self .content ) + '\n ' ))
461464 else :
462465 self .state .nested_parse (
@@ -479,7 +482,8 @@ def run(self):
479482 items .extend (print_action_groups (result , nested_content , markDownHelp ,
480483 settings = self .state .document .settings ))
481484 if 'nosubcommands' not in self .options :
482- items .extend (print_subcommands (result , nested_content , markDownHelp ))
485+ items .extend (print_subcommands (result , nested_content , markDownHelp ,
486+ settings = self .state .document .settings ))
483487 if 'epilog' in result and 'noepilog' not in self .options :
484488 items .append (self ._nested_parse_paragraph (result ['epilog' ]))
485489
0 commit comments