diff --git a/scripts/generate.py b/scripts/generate.py index e9bed85..8e27fde 100644 --- a/scripts/generate.py +++ b/scripts/generate.py @@ -592,10 +592,14 @@ def render(headline, doc, graph, headlineLevel): tag_list.append(f'{html.escape(tag)}') tags = f'{"".join(tag_list)}' - # display_state = 'collapsed' - # if headlineLevel < MIN_HIDDEN_HEADLINE_LEVEL: - # display_state = 'expanded' display_state = 'expanded' + # Update display based on document STARTUP config + visual_level = doc.get_keywords('STARTUP', 'showall') + if visual_level.startswith('show') and visual_level.endswith('levels'): + visual_level_num = int(visual_level[len('show'):-len('levels')]) - 1 + # Note that level is 0 indexed inside this loop + if headlineLevel >= visual_level_num: + display_state = 'collapsed' title = render_inline(headline.title, render_tag, headline, graph)