From bb6d7c4a394e61574f5f32db60da5c5f5a5e5002 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Wed, 3 Sep 2014 03:54:11 +0200 Subject: 342/99 --- src/html/html.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/html/html.c b/src/html/html.c index 27ffe58..3bd5df0 100644 --- a/src/html/html.c +++ b/src/html/html.c @@ -102,9 +102,26 @@ void blocks_to_html(gh_buf *html, block *b, bool tight) case indented_code: case fenced_code: - /* TODO: fenced code lang attributes */ cr(html); - gh_buf_puts(html, "
");
+
+				gh_buf_puts(html, "tag == fenced_code) {
+					gh_buf *info = &b->attributes.fenced_code_data.info;
+
+					if (gh_buf_len(info) > 0) {
+						int first_tag = gh_buf_strchr(info, ' ', 0);
+						if (first_tag < 0)
+							first_tag = gh_buf_len(info);
+
+
+						gh_buf_puts(html, " class=\"");
+						escape_html(html, info->ptr, first_tag);
+						gh_buf_putc(html, '"');
+					}
+				}
+
+				gh_buf_puts(html, ">");
 				escape_html(html, b->string_content.ptr, b->string_content.size);
 				gh_buf_puts(html, "
"); cr(html); -- cgit v1.2.3