Ejemplo n.º 1
0
static void translate_sourcepos(cmark_node *parent, unsigned long col,
                                int *actual_line, int *actual_col) {
    const char *contents = cmark_node_get_string_content(parent);
    *actual_line = cmark_node_get_start_line(parent);
    *actual_col = cmark_node_get_start_column(parent);
    unsigned long tmp_col = 0;

    if (strlen(contents) < col)
        return;

    while (tmp_col++ < col) {
        *actual_col += 1;
        if (contents[tmp_col] == '\n') {
            *actual_col = 0;
            *actual_line += 1;
        }
    }
}
Ejemplo n.º 2
0
static void commonmark_render(cmark_syntax_extension *extension,
                              cmark_renderer *renderer, cmark_node *node,
                              cmark_event_type ev_type, int options) {
  renderer->out(renderer, node, cmark_node_get_string_content(node), false, LITERAL);
}