diff --git a/examples/main.yml b/examples/main.yml index 6eb1d57..d71f913 100644 --- a/examples/main.yml +++ b/examples/main.yml @@ -88,7 +88,7 @@ collectd_plugins_default_config: IgnoreSelected true # -# Indention of Literal Blocks behind Lists +# Indention of Literal Blocks behind Lists [[[1 # ----------------------------------------- # # Code will properly be indented after lists: diff --git a/yaml2rst.py b/yaml2rst.py index 6b4c429..9e04b0e 100644 --- a/yaml2rst.py +++ b/yaml2rst.py @@ -104,6 +104,9 @@ def convert(lines): elif line.startswith('# ') or line == '#': if state != STATE_TEXT: yield '' + # Filter out [[[\d and ]]] at the end of a documentation line. + # Those sequences can be used for folding sections. + line = re.sub(r"\s*(:?\[{3}|\]{3})\d?$", "", line) line = last_text_line = line[2:] yield line last_indent = get_indent(line) * ' '