Skip to content

Instantly share code, notes, and snippets.

@CribberSix
Created November 1, 2021 17:45
Show Gist options
  • Save CribberSix/8019d9986a51aff6773bd44f5fe834c8 to your computer and use it in GitHub Desktop.
Save CribberSix/8019d9986a51aff6773bd44f5fe834c8 to your computer and use it in GitHub Desktop.
def remove_code_blocks(content: List[str]) -> List[str]:
content_cleaned = []
code_block = False
for x in content:
# detect code blocks, act accordingly
if x[:3] == '```':
code_block = not code_block
elif not code_block:
content_cleaned.append(x)
return content_cleaned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment