Skip to content

Instantly share code, notes, and snippets.

@scoavoux
Last active February 16, 2016 22:35
Show Gist options
  • Save scoavoux/27e4ca56b4101a88313a to your computer and use it in GitHub Desktop.
Save scoavoux/27e4ca56b4101a88313a to your computer and use it in GitHub Desktop.
Increases markdown headers of one level
from pandocfilters import toJSONFilter, Header
# proposed as an answer here http://stackoverflow.com/a/35341506/4132844
def header_increase(key, value, format, meta):
if key == 'Header' and value[0] < 7:
value[0] = value[0] + 1
return Header(value[0], value[1], value[2])
if __name__ == "__main__":
toJSONFilter(header_increase)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment