diff --git a/slither/utils/command_line.py b/slither/utils/command_line.py index 18ea36697..d1a495a23 100644 --- a/slither/utils/command_line.py +++ b/slither/utils/command_line.py @@ -50,15 +50,48 @@ def output_to_markdown(detector_classes, printer_classes, filter_wiki): print('{} | `{}` | {}'.format(idx, argument, help_info)) idx = idx + 1 +def get_level(l): + tab = l.count('\t') + 1 + if l.replace('\t', '').startswith(' -'): + tab = tab + 1 + if l.replace('\t', '').startswith('-'): + tab = tab + 1 + return tab + +def convert_result_to_markdown(txt): + # -1 to remove the last \n + lines = txt[0:-1].split('\n') + ret = [] + level = 0 + for l in lines: + next_level = get_level(l) + prefix = '
  • ' + if next_level < level: + prefix = ''*(level - next_level) + prefix + if next_level > level: + prefix = '