Text-Markdown-Hoedown

 view release on metacpan or  search on metacpan

hoedown/src/document.c  view on Meta::CPAN

	doc->ext_flags = extensions;
	doc->max_nesting = max_nesting;
	doc->in_link_body = 0;

	return doc;
}

void
hoedown_document_render(hoedown_document *doc, hoedown_buffer *ob, const uint8_t *data, size_t size)
{
	static const uint8_t UTF8_BOM[] = {0xEF, 0xBB, 0xBF};

	hoedown_buffer *text;
	size_t beg, end;

	int footnotes_enabled;

	text = hoedown_buffer_new(64);

	/* Preallocate enough space for our buffer to avoid expanding while copying */
	hoedown_buffer_grow(text, size);

hoedown/src/document.c  view on Meta::CPAN


	/* reset the footnotes lists */
	if (footnotes_enabled) {
		memset(&doc->footnotes_found, 0x0, sizeof(doc->footnotes_found));
		memset(&doc->footnotes_used, 0x0, sizeof(doc->footnotes_used));
	}

	/* first pass: looking for references, copying everything else */
	beg = 0;

	/* Skip a possible UTF-8 BOM, even though the Unicode standard
	 * discourages having these in UTF-8 documents */
	if (size >= 3 && memcmp(data, UTF8_BOM, 3) == 0)
		beg += 3;

	while (beg < size) /* iterating over lines */
		if (footnotes_enabled && is_footnote(data, beg, size, &end, &doc->footnotes_found))
			beg = end;
		else if (is_ref(data, beg, size, &end, doc->refs))
			beg = end;
		else { /* skipping to the next line */
			end = beg;
			while (end < size && data[end] != '\n' && data[end] != '\r')



( run in 0.319 second using v1.01-cache-2.11-cpan-131fc08a04b )