Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make Sundown render blockquotes (lines that start with ">")

For whatever reason, Sundown (more specifically Snudown, a fork of it) doesn't seem to output lines like:

> some text

As blockquotes in HTML, like it should, as it's valid Markdown. I know there are extensions in Sundown that allow certain features, but I cannot find one for quotes.

Here's the code I'm using (it's in Objective-C, but for the most part it's C):

struct sd_callbacks callbacks;
struct html_renderopt options;
const char *rawMarkdown = [markdownString cStringUsingEncoding:NSUTF8StringEncoding];
struct buf *inputBuffer = bufnew(strlen(rawMarkdown));
bufputs(inputBuffer, rawMarkdown);

// Parse the Markdown
struct buf *outputBuffer = bufnew(64);
sdhtml_renderer(&callbacks, &options, 0);
unsigned int extensions = MKDEXT_NO_INTRA_EMPHASIS|MKDEXT_TABLES|MKDEXT_FENCED_CODE|MKDEXT_AUTOLINK|MKDEXT_STRIKETHROUGH|MKDEXT_SUPERSCRIPT|MKDEXT_LAX_SPACING;
struct sd_markdown *markdown = sd_markdown_new(extensions, 16, 4, &callbacks, &options);
sd_markdown_render(outputBuffer, inputBuffer->data, inputBuffer->size, markdown);
sd_markdown_free(markdown);

NSString *HTML = [NSString stringWithCString:bufcstr(outputBuffer) encoding:NSUTF8StringEncoding];

bufrelease(inputBuffer);
bufrelease(outputBuffer);

NSLog(@"%@", HTML);

If a sample project would be helpful to show the issue, please just say so.

like image 232
Doug Smith Avatar asked Apr 28 '15 03:04

Doug Smith


1 Answers

In HTML, '<' and '>' cannot be used directly,

Use an html entity:

&gt; to display >

&lt; to display <

Click edit to view it, the entity codes were used instead of '>' and '<'.

like image 182
SleepyNeko Avatar answered Nov 14 '22 01:11

SleepyNeko