def render_markdown_doc(meta, text, doc, request): html, toc = markdown_and_toc(text) return render_to_response( meta.get('template', 'doc.html'), { 'title': doc.title, 'doc': doc, 'html': html, 'toc': toc, }, context_instance=RequestContext(request), )
def render_markdown_doc(path, meta, text, doc, request): # Reload markdown docs if in development if settings.DEBUG: with path.open() as f: text, meta = text_and_meta(f) html, toc = markdown_and_toc(text) return render( request, meta.get('template', 'docs/doc.html'), { 'title': meta['title'], 'doc': doc, 'html': html, 'toc': toc, }, )
def render_markdown_doc(path: Path, meta: Dict[str, Any], text: str, doc: Document, request: Any) -> HttpResponse: # Reload markdown docs if in development if settings.DEBUG: with path.open() as f: text, meta = text_and_meta(f) html, toc = markdown_and_toc(text) return render( request, meta.get('template', 'docs/doc.html'), { 'title': meta['title'], 'doc': doc, 'html': html, 'toc': toc, }, )
def assert_markdown(content, expected_html, expected_toc=None): html, toc = markdown_and_toc(dedent(content)) assert html.strip() == dedent(expected_html).strip() if expected_toc is not None: assert toc == expected_toc