add [TOC] to pdf generation

This commit is contained in:
Fred Pauchet 2018-02-19 15:42:20 +01:00
parent 7f01692124
commit d081fb4b48
2 changed files with 4 additions and 2 deletions

Binary file not shown.

View File

@ -21,13 +21,15 @@ class Section(models.Model):
def to_pdf():
x = ''
x = '[TOC]\n'
for section in Section.objects.all():
x += '# ' + section.title
x += '\n'
x += section.content
x += '\n'
html = Markdown().convert(x)
md = Markdown(extensions=['markdown.extensions.toc'])
html = md.convert(x)
options = {
'page-size': 'Letter',