Sha256: 831f0a969c9381aec710cca34823745b1c5183857fadf56cb66e6bb381659523

Contents?: true

Size: 1.1 KB

Versions: 15

Compression:

Stored size: 1.1 KB

Contents

#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include "registry.h"
#include "node.h"
#include "houdini.h"
#include "cmark.h"
#include "buffer.h"

cmark_node_type CMARK_NODE_LAST_BLOCK = CMARK_NODE_THEMATIC_BREAK;
cmark_node_type CMARK_NODE_LAST_INLINE = CMARK_NODE_IMAGE;

int cmark_version() { return CMARK_VERSION; }

const char *cmark_version_string() { return CMARK_VERSION_STRING; }

static void *xcalloc(size_t nmem, size_t size) {
  void *ptr = calloc(nmem, size);
  if (!ptr)
    abort();
  return ptr;
}

static void *xrealloc(void *ptr, size_t size) {
  void *new_ptr = realloc(ptr, size);
  if (!new_ptr)
    abort();
  return new_ptr;
}

static void xfree(void *ptr) {
  free(ptr);
}

cmark_mem CMARK_DEFAULT_MEM_ALLOCATOR = {xcalloc, xrealloc, xfree};

cmark_mem *cmark_get_default_mem_allocator() {
  return &CMARK_DEFAULT_MEM_ALLOCATOR;
}

char *cmark_markdown_to_html(const char *text, size_t len, int options) {
  cmark_node *doc;
  char *result;

  doc = cmark_parse_document(text, len, options);

  result = cmark_render_html(doc, options, NULL);
  cmark_node_free(doc);

  return result;
}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
commonmarker-0.14.15 ext/commonmarker/cmark/src/cmark.c
commonmarker-0.14.14 ext/commonmarker/cmark/src/cmark.c
commonmarker-0.14.13 ext/commonmarker/cmark/src/cmark.c
commonmarker-0.14.12 ext/commonmarker/cmark/src/cmark.c
commonmarker-0.14.11 ext/commonmarker/cmark/src/cmark.c
commonmarker-0.14.9 ext/commonmarker/cmark/src/cmark.c
commonmarker-0.14.8 ext/commonmarker/cmark/src/cmark.c
commonmarker-0.14.7 ext/commonmarker/cmark/src/cmark.c
commonmarker-0.14.6 ext/commonmarker/cmark/src/cmark.c
commonmarker-0.14.5 ext/commonmarker/cmark/src/cmark.c
commonmarker-0.14.4 ext/commonmarker/cmark/src/cmark.c
commonmarker-0.14.3 ext/commonmarker/cmark/src/cmark.c
commonmarker-0.14.2 ext/commonmarker/cmark/src/cmark.c
commonmarker-0.14.1 ext/commonmarker/cmark/src/cmark.c
commonmarker-0.14.0 ext/commonmarker/cmark/src/cmark.c