def validate_markdown()

in scripts/sanity_check.py [0:0]


    def validate_markdown(self, markdown):
        m = mistune.create_markdown(renderer=mistune.AstRenderer())

        for block in m(markdown):
            if block['type'] == 'heading':
                # we dont want colon after section names
                text_children = [c for c in block['children'] if c['type'] == 'text']
                for c in text_children:
                    assert not c['text'].endswith(':')
                    if c['text'] in self.required_sections:
                        self.required_sections.remove(c['text'])
        try:
            assert len(self.required_sections) == 0
        except AssertionError as e:
            print("Missing required sections: {}".format(self.required_sections))
            raise e