Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// stupid simple markdown template strings
// dervied from https://github.com/brianleroux/micromark
var commonmark = require('commonmark');
var deindent = require('deindent');
var reader = new commonmark.DocParser();
var writer = new commonmark.HtmlRenderer();
var LINE_BREAK = /\n/;
var P_TAG_WRAP = /^<p>(.*)<\/p>\r?\n?$/i;
function markdownTag(strings) {
var input = strings[0];
for (var i = 1, length = arguments.length; i < length; ++i) {
input += arguments[i] + strings[i];
}
var parsed = writer.render(reader.parse(input));
// if string is all on one line (contains no line breaks) strip </p><p> wrapper
if (!LINE_BREAK.test(input)) {
var wrapped = parsed.match(P_TAG_WRAP);
if (wrapped) {
parsed = wrapped[1];</p>
/*eslint-disable */
// LICENSE : MIT
// Base:
// Copyright (c) 2014, John MacFarlane
// https://github.com/jgm/CommonMark/blob/master/js/lib/html-renderer.js
"use strict";
var traverse = require('traverse');
var positionNode = require("./markdown-position-node");
var StructuredSource = require('structured-source');
var Syntax = require("./markdown-syntax");
var commonmark = require("commonmark");
var normalize = require("./markdown-normalizer");
var objectAssign = require("object-assign");
var reader = new commonmark.DocParser();
// Helper function to produce content in a pair of HTML tags.
var toPlainText = function (tag, attribs, contents, selfclosing) {
return contents;
};
// Render an inline element as HTML.
var renderInline = function (inline, parent) {
var attrs;
switch (inline.t) {
case 'Str':
return this.escape(inline.c);
case 'Softbreak':
return this.softbreak;
case 'Hardbreak':
return toPlainText('br', [], "", true) + '\n';