Exemplo n.º 1
0
void Preview::refresh()
{
	if (!needRefresh)
		return;
	
	if (type == MARKDOWN)
	{
		qDebug() << "Render Markdown and refresh preview";

		std::string std_str = content.toStdString();
		const char* cstr = std_str.c_str();

		hoedown_buffer_set(buf, 0, 0);

		hoedown_document_render(document, buf, (const uint8_t*)cstr, strlen(cstr));

		QString html((const char*)buf->data);
		html = themelize(html);

		webView->setHtml(html);

		needRefresh = false;
	}
	else if (type == HTML)
	{
		qDebug() << "Render html and refresh preview";
		qDebug() << "content: " << content;

		webView->setHtml(content);
		needRefresh = false;
	}
	
}
Exemplo n.º 2
0
void
hoedown_buffer_sets(hoedown_buffer *buf, const char *str)
{
	hoedown_buffer_set(buf, (const uint8_t *)str, strlen(str));
}