commonmark-lua - Lua binding to libcmark commonmark parser

  •        0

local cmark = require("commonmark")local W = require("commonmark.writer.html")local inp = io.read("*all")local doc = cmark.parse_document(inp, string.len(inp))writer = W.new()-- customize the writer:writer.text = function(node) local s = cmark.node_get_string_content(node) writer.out(writer.escape(s:upper()))endio.write(writer.render(doc))for warning in writer.warnings() do print('WARNING', warning)end```Alternatively, you could walk the AST, changing text content touppercase, and use the faster libcmark HTML renderer:``` lua

https://github.com/jgm/commonmark-lua

Tags
Implementation
License
Platform

   

comments powered by Disqus


Related Projects