Expects a string of markdown and returns a string which has been formatted for
displaying on the console.

@param string $markdown
@return string
518321
public function render($markdown)
    {
        $ast = $this->docParser->parse($markdown);
        return $this->cliRenderer->renderBlock($ast);
    }
227551
public static String markdownToHtml(String markdownString) {
		if (StringUtils.isBlank(markdownString)) {
			return "";
		}
		return HTML_RENDERER.render(MD_PARSER.parse(markdownString));
	}
137836
def _escape_markdown_literals(string):
    
    literals = list("\\`*_{}[]()<>#+-.!:|")
    escape = lambda c: '\\' + c if c in literals else c
    return "".join(map(escape, string))
783131
protected function processMarkdown()
    {
        /** @var Config $config */
        $config = Grav::instance()['config'];

        $defaults = (array)$config->get('system.pages.markdown');
        if (isset($this->header()->markdown)) {
            $defaults = array_merge($defaults, $this->header()->markdown);
        }

        // pages.markdown_extra is deprecated, but still check it...
        if (!isset($defaults['extra']) && (isset($this->markdown_extra) || $config->get('system.pages.markdown_extra') !== null)) {
            user_error('Configuration option \'system.pages.markdown_extra\' is deprecated since Grav 1.5, use \'system.pages.markdown.extra\' instead', E_USER_DEPRECATED);

            $defaults['extra'] = $this->markdown_extra ?: $config->get('system.pages.markdown_extra');
        }

        // Initialize the preferred variant of Parsedown
        if ($defaults['extra']) {
            $parsedown = new ParsedownExtra($this, $defaults);
        } else {
            $parsedown = new Parsedown($this, $defaults);
        }

        $this->content = $parsedown->text($this->content);
    }
1058253
def markdown_helper(string)
      return unless string
      Kramdown::Document.new(string.to_s).to_html.html_safe
    end
888854
def distribution_to_markdown(distribution):
    
    text_template = """
### {title}

{description}

#### Campos del recurso

{fields}
"""

    if "field" in distribution:
        fields = "- " + \
            "\n- ".join(map(field_to_markdown, distribution["field"]))
    else:
        fields = ""

    text = text_template.format(
        title=distribution["title"],
        description=distribution.get("description", ""),
        fields=fields
    )

    return text
15008
protected function buildMarkdownText($markdown, $data)
    {
        return $this->textView
                ?? $markdown->renderText($this->markdown, $data);
    }
1234621
public function parseMarkup()
    {
        $extension = strtolower(File::extension($this->fileName));

        switch ($extension) {
            case 'txt':
                $result = htmlspecialchars($this->markup);
                break;
            case 'md':
                $result = Markdown::parse($this->markup);
                break;
            default:
                $result = $this->markup;
        }

        return $result;
    }
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);
    }
1031922
public function markdown($content)
    {
        // Parse the field as Markdown, return HTML
        $output = $this->markdown->text($content);

        $config = $this->config->get('general/htmlcleaner');
        $allowedTags = !empty($config['allowed_tags']) ? $config['allowed_tags'] :
            ['div', 'p', 'br', 'hr', 's', 'u', 'strong', 'em', 'i', 'b', 'li', 'ul', 'ol', 'blockquote', 'pre', 'code', 'tt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'dd', 'dl', 'dh', 'table', 'tbody', 'thead', 'tfoot', 'th', 'td', 'tr', 'a', 'img'];
        $allowedAttributes = !empty($config['allowed_attributes']) ? $config['allowed_attributes'] :
            ['id', 'class', 'name', 'value', 'href', 'src'];

        // Sanitize/clean the HTML.
        $maid = new Maid(
            [
                'output-format'   => 'html',
                'allowed-tags'    => $allowedTags,
                'allowed-attribs' => $allowedAttributes,
            ]
        );
        $output = $maid->clean($output);

        return $output;
    }
959930
public static function escapeAndMarkdown(?string $content): string
    {
        return $content ? C::getMarkdown()->text(Html::escape($content)) : (string) $content;
    }
425312
function markdownFormat(str) {
  // if string...
  if(str && typeof str === 'string') {

    // process characters that do not render visibly in markdown
    str = str.replace(/\<(?!@)/g, '&lt;');
    str = str.split('').reverse().join('').replace(/\>(?!.*@\<)/g, ';tg&').split('').reverse().join('');

    return str;
  }

  // else return empty
  else {
    return '';
  }
}
2317
def field_to_markdown(field):
    
    if "title" in field:
        field_title = "**{}**".format(field["title"])
    else:
        raise Exception("Es necesario un `title` para describir un campo.")

    field_type = " ({})".format(field["type"]) if "type" in field else ""
    field_desc = ": {}".format(
        field["description"]) if "description" in field else ""

    text_template = "{title}{type}{description}"
    text = text_template.format(title=field_title, type=field_type,
                                description=field_desc)

    return text
1058820
def as_markdown(self):
        

        labels, data = self._get_table()
        table = MarkdownTable(labels, data)
        return str(table)
567698
def parse_markdown(self, attr_string):
        """"""
        attr_string = attr_string.strip('{}')
        splitter = re.compile(self.split_regex(separator=self.spnl))
        attrs = splitter.split(attr_string)[1::2]

        # match single word attributes e.g. ```python
        if len(attrs) == 1 \
                and not attr_string.startswith(('#', '.')) \
                and '=' not in attr_string:
            return '', [attr_string], OrderedDict()

        try:
            id = [a[1:] for a in attrs if a.startswith('#')][0]
        except IndexError:
            id = ''

        classes = [a[1:] for a in attrs if a.startswith('.')]
        special = ['unnumbered' for a in attrs if a == '-']
        classes.extend(special)

        kvs = OrderedDict(a.split('=', 1) for a in attrs if '=' in a)

        return id, classes, kvs
52473
public static function dumpInline(string $inline): string
    {
        if (false === strpos($inline, '"')) {
            return '"' . $inline . '"';
        }
        if (false === strpos($inline, "'")) {
            return "'$inline'";
        }
        return "<$inline>";
    }
720507
public function getRenderedDataAttribute() : ?string
    {
        if ($this->renderedData !== null) {
            return $this->renderedData;
        }

        if ($this->config->get('tracker.save_rendered', true) &&
            ($rendered = $this->getAttributeFromArray('data_rendered')) !== null) {
            return $this->renderedData = $rendered;
        }

        if (($raw = $this->getAttributeFromArray('data')) !== null) {
            return $this->renderedData = markdown($raw);
        }

        return null;
    }