def _filter_markdown(source, filters):
    lines = source.splitlines()
    # Filters is a list of 'hN' strings where 1 <= N <= 6.
    headers = [_replace_header_filter(filter) for filter in filters]
    lines = [line for line in lines if line.startswith(tuple(headers))]
    return '\n'.join(lines)
Only keep some Markdown headers from a Markdown string.
dataset/ETHPy150Open rossant/ipymd/ipymd/lib/markdown.py/_filter_markdown