Skip to content

Instantly share code, notes, and snippets.

@joelcarranza
Created June 28, 2015 18:13
Show Gist options
  • Save joelcarranza/1b572b67ec2947961105 to your computer and use it in GitHub Desktop.
Save joelcarranza/1b572b67ec2947961105 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""marked_processor.py
Pre-procceser for Marked.app which converts notation for structured notes
into HTML
Source:
https://gist.github.com/joelcarranza/1b572b67ec2947961105
"""
import sys
import re
def replace_id_references(input):
return re.sub(r'§(\d+_\d+)',r'[§\1](./\1.txt)',input)
if __name__ == '__main__':
input = sys.stdin.read()
output = replace_id_references(input)
print output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment