Fossil

Check-in [de94fdd1]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Switch to commonmark renderer
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | commonmark-markdown
Files: files | file ages | folders
SHA3-256:de94fdd1fabcf02654edff453fed99a0aa6c2b3b1d1bb10dc33006c680ed0eec
User & Date: mjanssen 2017-03-11 13:56:36
Context
2017-03-11
13:59
Add test commonmark test suite check-in: 98936190 user: mjanssen tags: commonmark-markdown
13:56
Switch to commonmark renderer check-in: de94fdd1 user: mjanssen tags: commonmark-markdown
13:52
Add commonmark amalgamations check-in: 116e744b user: mjanssen tags: commonmark-markdown
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/markdown_html.c.

17
18
19
20
21
22
23

24
25
26
27
28
29
30
...
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449





450
**
** This file contains callbacks for the markdown parser that generate
** XHTML output.
*/

#include "config.h"
#include "markdown_html.h"


#if INTERFACE

void markdown_to_html(
  struct Blob *input_markdown,
  struct Blob *output_title,
  struct Blob *output_body);
................................................................................
** output_title is NULL, the document title appears in the body.
*/
void markdown_to_html(
  struct Blob *input_markdown,   /* Markdown content to be rendered */
  struct Blob *output_title,     /* Put title here.  May be NULL */
  struct Blob *output_body       /* Put document body here. */
){
  struct mkd_renderer html_renderer = {
    /* prolog and epilog */
    html_prolog,
    html_epilog,

    /* block level elements */
    html_blockcode,
    html_blockquote,
    html_raw_block,
    html_header,
    html_hrule,
    html_list,
    html_list_item,
    html_paragraph,
    html_table,
    html_table_cell,
    html_table_row,

    /* span level elements */
    html_autolink,
    html_code_span,
    html_double_emphasis,
    html_emphasis,
    html_image,
    html_line_break,
    html_link,
    html_raw_span,
    html_triple_emphasis,

    /* low level elements */
    0,  /* entities are copied verbatim */
    html_normal_text,

    /* misc. parameters */
    64, /* maximum stack */
    "*_", /* emphasis characters */
    0 /* opaque data */
  };
  html_renderer.opaque = output_title;
  if( output_title ) blob_reset(output_title);
  blob_reset(output_body);
  markdown(output_body, input_markdown, &html_renderer);





}







>







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|

<
>
>
>
>
>

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
...
402
403
404
405
406
407
408







































409
410

411
412
413
414
415
416
**
** This file contains callbacks for the markdown parser that generate
** XHTML output.
*/

#include "config.h"
#include "markdown_html.h"
#include "cmark_amalgamation.h"

#if INTERFACE

void markdown_to_html(
  struct Blob *input_markdown,
  struct Blob *output_title,
  struct Blob *output_body);
................................................................................
** output_title is NULL, the document title appears in the body.
*/
void markdown_to_html(
  struct Blob *input_markdown,   /* Markdown content to be rendered */
  struct Blob *output_title,     /* Put title here.  May be NULL */
  struct Blob *output_body       /* Put document body here. */
){







































 if( output_title ) blob_reset(output_title);
  blob_reset(output_body);

  char *cmark_result = cmark_markdown_to_html(blob_str(input_markdown), blob_size(input_markdown), 0 );
  html_prolog(output_body,0);
  blob_append(output_body, cmark_result, strlen(cmark_result));
  html_epilog(output_body,0);
  free(cmark_result);
}