Render reddit markdown, poll tildes better, add utils

This commit is contained in:
2019-08-28 04:13:02 +00:00
parent 10d4ec863e
commit 23cdbc9292
6 changed files with 76 additions and 30 deletions

17
apiserver/utils.py Normal file
View File

@@ -0,0 +1,17 @@
import logging
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.DEBUG)
import commonmark
import random
import string
def gen_rand_id():
return ''.join(random.choice(string.ascii_uppercase) for _ in range(4))
def render_md(md):
if md:
return commonmark.commonmark(md)
else:
return ''