Sha256: 46b6b6727bd2bd2528a1d4ade26775b9744c56e00056427022b5cafe0280ee6c

Contents?: true

Size: 1.28 KB

Versions: 44

Compression:

Stored size: 1.28 KB

Contents

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

cmark_node_type CMARK_NODE_LAST_BLOCK = CMARK_NODE_FOOTNOTE_DEFINITION;
cmark_node_type CMARK_NODE_LAST_INLINE = CMARK_NODE_FOOTNOTE_REFERENCE;

int cmark_version() { return CMARK_GFM_VERSION; }

const char *cmark_version_string() { return CMARK_GFM_VERSION_STRING; }

static void *xcalloc(size_t nmem, size_t size) {
  void *ptr = calloc(nmem, size);
  if (!ptr) {
    fprintf(stderr, "[cmark] calloc returned null pointer, aborting\n");
    abort();
  }
  return ptr;
}

static void *xrealloc(void *ptr, size_t size) {
  void *new_ptr = realloc(ptr, size);
  if (!new_ptr) {
    fprintf(stderr, "[cmark] realloc returned null pointer, aborting\n");
    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

44 entries across 44 versions & 5 rubygems

Version Path
commonmarker-0.23.7 ext/commonmarker/cmark.c
qiita_marker-0.23.6.2 ext/qiita_marker/cmark.c
commonmarker-0.23.7.pre1 ext/commonmarker/cmark.c
qiita_marker-0.23.6.1 ext/qiita_marker/cmark.c
qiita_marker-0.23.6.0 ext/qiita_marker/cmark.c
commonmarker-0.23.6 ext/commonmarker/cmark.c
qiita_marker-0.23.5.1 ext/qiita_marker/cmark.c
qiita_marker-0.23.5.0 ext/qiita_marker/cmark.c
commonmarker-0.23.5 ext/commonmarker/cmark.c
qiita_marker-0.23.2.3 ext/qiita_marker/cmark.c
commonmarker-0.23.4 ext/commonmarker/cmark.c
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/commonmarker-0.23.2/ext/commonmarker/cmark.c
markly-0.7.0 ext/markly/cmark.c
qiita_marker-0.23.2.2 ext/qiita_marker/cmark.c
qiita_marker-0.23.2.1 ext/qiita_marker/cmark.c
qiita_marker-0.23.2.0 ext/qiita_marker/cmark.c
commonmarker-0.23.2 ext/commonmarker/cmark.c
commonmarker-0.23.1 ext/commonmarker/cmark.c
markly-0.6.1 ext/markly/cmark.c
commonmarker-0.23.0 ext/commonmarker/cmark.c