Returns the supplied Markdown as rendered HTML
@param {string} $markdown The markdown to render
@return {string} The rendered HTML
341893
public function getRenderedHTML($value) {
   		//Build object to send
        $sendObj=new stdClass();
        $sendObj->text=$value;
        $sendObj->mode=(self::$useGFM ? 'gmf':'markdown');
        $content=json_encode($sendObj);
        
        //Build headers
        $headers=array("Content-type: application/json", "User-Agent: curl");
        if(self::$useBasicAuth) {
            $encoded=base64_encode(self::$username.':'.self::$password);
            $headers[]="Authorization: Basic $encoded";
        }
        
        //Build curl request to github's api
        $curl=curl_init('https://api.github.com/markdown');
        curl_setopt($curl, CURLOPT_HEADER, false);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        
        
        //Send request and verify response
        $response=curl_exec($curl);
        $status=curl_getinfo($curl, CURLINFO_HTTP_CODE);
        if($status!=200) {
            user_error("Error: Call to api.github.com failed with status $status, response $response, curl_error ".curl_error($curl).", curl_errno ".curl_errno($curl), E_USER_WARNING);
        }
        
        //Close curl connection
        curl_close($curl);
        
        return $response;
	}
158540
function getMarkdownParagraph(): \Closure {
    return function($value, \Mustache_LambdaHelper $helper) {
      $args = $this->parseArguments($helper->render($value), 'markdown', ['flavor' => Markdown::$defaultFlavor]);
      return Markdown::processParagraph($args['markdown'], $args['flavor']);
    };
  }
394888
function md2html( file ){
  file = file.substr( file.length - 3 ) === '.md' ? file : file + '.md'; // add extension if need be

  let md;
  try{
    md = fs.readFileSync( path.join(__dirname, './md', file) , 'utf8');
  } catch(e){
    throw 'A markdown file named `' + file + '` was referenced but could not be read';
  }

  // let html = converter.makeHtml( md );
  //let html = mdConvertor( md );
  let html = marked( md, {
    highlight: function(code, lang){
      let ret;

      if( lang ){
        ret = hljs.highlight(lang, code).value;
      } else {
        ret = hljs.highlightAuto(code).value;
      }

      return ret;

    },

    smartypants: true,

    renderer: mdRend,

    gfm: true
  } );


  return html;
}
1341901
public static function Markdown($Mixed) {
      if (!is_string($Mixed)) {
         return self::To($Mixed, 'Markdown');
      } else {         
         $Formatter = Gdn::Factory('HtmlFormatter');
         if (is_null($Formatter)) {
            return Gdn_Format::Display($Mixed);
         } else {
            require_once(PATH_LIBRARY.'/vendors/markdown/markdown.php');
            $Mixed = Markdown($Mixed);
            $Mixed = $Formatter->Format($Mixed);
            $Mixed = Gdn_Format::Links($Mixed);
            $Mixed = Gdn_Format::Mentions($Mixed);
            return $Mixed;
         }
      }
   }
427820
def markdown(doc, title=True, template='short_documentation.md'):
    """"""

    from jinja2 import Environment, PackageLoader, select_autoescape
    env = Environment(
        loader=PackageLoader('metapack', 'support/templates')
        #autoescape=select_autoescape(['html', 'xml'])
    )

    context = display_context(doc)

    return env.get_template(template).render(**context)
360899
public function setPretext($pretext, $markdown = false)
    {
        $this->data['pretext'] = $pretext;
        $this->markdownInPretext = $markdown;

        return $this;
    }
1143094
public static function markdown(&$content)
    {
        if (self::$MarkdownParser === null) {
            if (class_exists('dflydev\markdown\MarkdownParser')) {
                self::$MarkdownParser = new \dflydev\markdown\MarkdownParser;
            } else {
                self::$MarkdownParser = false;
            }
        }

        if (self::$MarkdownParser !== false) {
            $content = trim(self::$MarkdownParser->transformMarkdown($content));
        }

        return $content;
    }
1338917
func Markdown(input interface{}, urlPrefix string, metas map[string]string) []byte {
	return Render(MARKDOWN, input, urlPrefix, metas)
}
1062520
public function render($html = null) {
		$separator = $this->getSeparator();
		$result    = '';
		
		foreach ($this->getElements() as $element) {
			$result .= $separator . $element->render();
		}
		
		return parent::render($result . $separator);
	}
760005
public function getHtmlByMarkdown($string)
    {
        if (false === class_exists('\Parsedown')) {
            throw new \RuntimeException('Missing Parsedown. Try: composer require "erusev/parsedown" "^1.6.1"');
        }

        $parse = new Parsedown();
        $parse->setBreaksEnabled($this->isParameterParseDownBreaksEnabled());

        return $parse->text($string);
    }
948594
public function render($content, $data = [])
    {
        if (!$content) {
            return '';
        }

        $html = $this->renderTwig($content, $data);

        $html = Markdown::parseSafe($html);

        return $html;
    }
26335
protected function parseLink($markdown)
    {
        if (!in_array('parseLink', array_slice($this->context, 1)) && preg_match('/^\[\[(.*?)\]\]/', $markdown, $matches)) {
            // '[[link]]
            if (preg_match('/^(.+?)\|(.*)$/', $matches[1], $parts)) {
                // 'link|text' pattern
                $url = $parts[1];
                $text = ($parts[2] == '') ? $parts[1] : $parts[2];
            } else {
                // 'link' only pattern
                $url = $matches[1];
                $text = $matches[1];
            }
            if (!preg_match('/^(https?|ftp):\/\//', $url)) {
                // not an external link, i.e., a wiki link
                if (preg_match('/^(.*):(.*)$/', $url, $urlMatches)) {
                    // inter wiki link
                    $extWiki = $urlMatches[1];
                    if (isset($this->externalWikis[$extWiki])) {
                        $url = $this->externalWikis[$extWiki] . urlencode($urlMatches[2]);
                    } else {
                        return [
                            [
                                'text',
                                $matches[0],
                            ],
                            strlen($matches[0])
                        ];
                    }
                } else {
                    // internal link
                    $url = $this->wikiUrl . urlencode($url);
                }
            }
            return [
                [
                    'link',
                    'text' => $this->parseInline($text),
                    'url' => $url,
                ],
                strlen($matches[0])
            ];
        } else {
            // remove all starting [ markers to avoid next one to be parsed as link
            $result = '[[';
            $i = 2;
            while (isset($markdown[$i]) && $markdown[$i] == '[') {
                $result .= '[';
                $i++;
            }
            return [['text', $result], $i];
        }
    }
460033
protected function renderMarkdown()
    {
        $markdownFileBuilder = new MarkdownFileBuilder($this->filesystem, $this->viewFactory, $this->file, $this->viewsData);

        return $markdownFileBuilder->render();
    }
666722
public function markdown($var = null)
    {
        $content = $this->content();

        if ($var !== null) {
            $content['markdown'] = (string) $var;
            $this->content($content);
        }

        return $content['markdown'];
    }
930930
function markdown(text, nohl) {
    let r, codes;

    md.set({
      highlight: (str, lang) => {
        let esc = md.utils.escapeHtml;

        try {
          if (lang && lang !== 'auto' && hljs.getLanguage(lang)) {
            return '<pre class="hljs language-' + esc(lang.toLowerCase()) + '"><code>' +
                   hljs.highlight(lang, str, true).value +
                   '</code></pre>';

          } else if (!lang || lang === 'auto') {
            let result = hljs.highlightAuto(str);

            return '<pre class="hljs language-' + esc(result.language) + '"><code>' +
                   result.value +
                   '</code></pre>';
          }
        } catch (__) { /**/ }

        return '<pre class="hljs"><code>' + esc(str) + '</code></pre>';
      }
    });

    md.renderer.rules['code_block'] = function (tokens, idx /*, options, env */) {
      let esc = md.utils.escapeHtml;
      return '<pre class="hljs"><code>' + esc(tokens[idx].content) + '</code></pre>\n';
    };

    if (nohl) md.set({ highlight: null });

    r = md.render(text);

    // FIXME
    // desugar [[foo#bar]] tokens into local links
    // N.B. in order to not apply conversion in <code> blocks,
    // we first store replace code blocks with nonces
    codes = {};
    r = r.replace(/(<code>[\s\S]*?<\/code>)/g, (all, def) => {
      let nonce = Math.random().toString().substring(2);
      codes[nonce] = def;
      return `@-=@=-@${nonce}@-=@=-@`;
    });

    // convert [[link]] to links
    r = r.replace(/\[\[([\s\S]+?)\]\]/g, (all, def) => {
      def = def.split(/\s+/);
      id = def.shift();
      // invalid references don't produce links
      if (!list[id]) {
        if (options.brokenLinks === 'throw') {
          throw new Error(`Link is broken: ${all}\n${r}`);
        }
        return options.brokenLinks === 'show' ? all : id;
      }

      let obj = _.extend({ name: def.join(' ') || id }, list[id]);
      return link(obj, false, [ 'link-short' ]);
    });
    // restore code blocks, given previously stored nonces
    r = r.replace(/@-=@=-@(\d+)@-=@=-@/g, (all, nonce) => codes[nonce]);
    //
    return r;
  }
873226
function Markdown(runner, options) {
  Base.call(this, runner, options);

  var level = 0;
  var buf = '';

  function title(str) {
    return Array(level).join('#') + ' ' + str;
  }

  function mapTOC(suite, obj) {
    var ret = obj;
    var key = SUITE_PREFIX + suite.title;

    obj = obj[key] = obj[key] || {suite: suite};
    suite.suites.forEach(function(suite) {
      mapTOC(suite, obj);
    });

    return ret;
  }

  function stringifyTOC(obj, level) {
    ++level;
    var buf = '';
    var link;
    for (var key in obj) {
      if (key === 'suite') {
        continue;
      }
      if (key !== SUITE_PREFIX) {
        link = ' - [' + key.substring(1) + ']';
        link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
        buf += Array(level).join('  ') + link;
      }
      buf += stringifyTOC(obj[key], level);
    }
    return buf;
  }

  function generateTOC(suite) {
    var obj = mapTOC(suite, {});
    return stringifyTOC(obj, 0);
  }

  generateTOC(runner.suite);

  runner.on(EVENT_SUITE_BEGIN, function(suite) {
    ++level;
    var slug = utils.slug(suite.fullTitle());
    buf += '<a name="' + slug + '"></a>' + '\n';
    buf += title(suite.title) + '\n';
  });

  runner.on(EVENT_SUITE_END, function() {
    --level;
  });

  runner.on(EVENT_TEST_PASS, function(test) {
    var code = utils.clean(test.body);
    buf += test.title + '.\n';
    buf += '\n```js\n';
    buf += code + '\n';
    buf += '```\n\n';
  });

  runner.once(EVENT_RUN_END, function() {
    process.stdout.write('# TOC\n');
    process.stdout.write(generateTOC(runner.suite));
    process.stdout.write(buf);
  });
}
1312741
def fromMarkdown(md, *args, **kwargs):
        
        return TOC.fromHTML(markdown(md, *args, **kwargs))