Skip to content

Commit

Permalink
Allow maximum nesting when rendering
Browse files Browse the repository at this point in the history
Fix #160.
  • Loading branch information
uranusjr committed Sep 15, 2014
1 parent 1872d75 commit 64857c8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions MacDown/Code/Document/MPRenderer.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "MPRenderer.h"
#import <limits.h>
#import <hoedown/html.h>
#import <hoedown/markdown.h>
#import "hoedown_html_patch.h"
Expand All @@ -21,6 +22,7 @@
@"?config=TeX-AMS-MML_HTMLorMML";
static NSString * const kMPPrismScriptDirectory = @"Prism/components";
static NSString * const kMPPrismThemeDirectory = @"Prism/themes";
static size_t kMPRendererNestingLevel = SIZE_MAX;


static NSArray *MPPrismScriptURLsForLanguage(NSString *language)
Expand Down Expand Up @@ -62,7 +64,8 @@
hoedown_renderer *htmlRenderer, hoedown_renderer *tocRenderer)
{
NSData *inputData = [text dataUsingEncoding:NSUTF8StringEncoding];
hoedown_markdown *markdown = hoedown_markdown_new(flags, 15, htmlRenderer);
hoedown_markdown *markdown = hoedown_markdown_new(
flags, kMPRendererNestingLevel, htmlRenderer);
hoedown_buffer *ob = hoedown_buffer_new(64);
hoedown_markdown_render(ob, inputData.bytes, inputData.length, markdown);
if (smartypants)
Expand All @@ -78,7 +81,8 @@

if (tocRenderer)
{
markdown = hoedown_markdown_new(flags, 15, tocRenderer);
markdown = hoedown_markdown_new(flags,
kMPRendererNestingLevel, tocRenderer);
ob = hoedown_buffer_new(64);
hoedown_markdown_render(
ob, inputData.bytes, inputData.length, markdown);
Expand Down Expand Up @@ -237,7 +241,7 @@ @interface MPRenderer ()
static hoedown_renderer *MPCreateHTMLRenderer(MPRenderer *renderer)
{
int flags = renderer.rendererFlags;
hoedown_renderer *htmlRenderer = hoedown_html_renderer_new(flags, 6);
hoedown_renderer *htmlRenderer = hoedown_html_renderer_new(flags, 0);
htmlRenderer->blockcode = hoedown_patch_render_blockcode;
htmlRenderer->listitem = hoedown_patch_render_listitem;

Expand Down Expand Up @@ -416,7 +420,7 @@ - (void)parse
hoedown_renderer *htmlRenderer = MPCreateHTMLRenderer(self);
hoedown_renderer *tocRenderer = NULL;
if (hasTOC)
tocRenderer = hoedown_html_toc_renderer_new(6);
tocRenderer = hoedown_html_toc_renderer_new(0);
self.currentHtml = MPHTMLFromMarkdown(
markdown, extensions, smartypants, [frontMatter HTMLTable],
htmlRenderer, tocRenderer);
Expand Down

0 comments on commit 64857c8

Please sign in to comment.