check if current tag can be converted to Markdown

@param void
@return bool
13507
protected function isMarkdownable()
    {
        if (!isset($this->isMarkdownable[$this->parser->tagName])) {
            // simply not markdownable

            return false;
        }
        if ($this->parser->isStartTag) {
            $return = true;
            if ($this->keepHTML) {
                $diff = array_diff(array_keys($this->parser->tagAttributes), array_keys($this->isMarkdownable[$this->parser->tagName]));
                if (!empty($diff)) {
                    // non markdownable attributes given
                    $return = false;
                }
            }
            if ($return) {
                foreach ($this->isMarkdownable[$this->parser->tagName] as $attr => $type) {
                    if ($type == 'required' && !isset($this->parser->tagAttributes[$attr])) {
                        // required markdown attribute not given
                        $return = false;
                        break;
                    }
                }
            }
            if (!$return) {
                array_push($this->notConverted, $this->parser->tagName . '::' . implode('/', $this->parser->openTags));
            }

            return $return;
        } else {
            if (!empty($this->notConverted) && end($this->notConverted) === $this->parser->tagName . '::' . implode('/', $this->parser->openTags)) {
                array_pop($this->notConverted);

                return false;
            }

            return true;
        }
    }
812398
public function col_isstandard($tag) {
        global $OUTPUT;
        $tagoutput = new core_tag\output\tagisstandard($tag);
        return $tagoutput->render($OUTPUT);
    }
414117
public function isWritable()
    {
        if (null !== ($uri = $this->getMetadata('uri'))) {
            if (is_writable($uri)) {
                return true;
            } elseif (null !== ($mode = $this->getMetadata('mode'))) {
                preg_match_all('/[a-z]\D?/', $mode, $matches);

                if (isset($matches[ 0 ])) {
                    foreach ($matches[ 0 ] as $match) {
                        if (in_array($match, ['r+', 'w', 'w+', 'a', 'a+', 'x', 'x+', 'c', 'c+'])) {
                            return true;

                            break;
                        }
                    }
                }
            }
        }

        return false;
    }
1133645
private function checkImageTitleTags() {

        $html = $this->getPageContent();

        // for newly created page
        if ($html == '') {
            return false;
        }

        $dom = $this->createDOMDocumentFromHTML($html);

        $images = $dom->getElementsByTagName('img');

        $imagesWithTitleTags = 0;
        foreach($images as $image){
            if($image->hasAttribute('title') && $image->getAttribute('title') != ''){
                //echo $image->getAttribute('title') . '<br>';
                $imagesWithTitleTags++;
            }
        }

        if($imagesWithTitleTags == $images->length){
            return true;
        }

        return false;
    }
503684
public function hasTag($tag)
    {
        if ($this->isTopTag($tag)) {
            return true;
        }

        return isset($this->tags[$tag]) && is_array($this->tags[$tag]);
    }
593519
protected function handleTag_fn()
    {
        if ($this->parser->isStartTag) {
            $this->out('[^' . $this->parser->tagAttributes['name'] . ']:');
            $this->setLineBreaks(1);
        } else {
            $this->setLineBreaks(2);
        }
        $this->indent('    ');
    }
15475
public function markup($nodes = null, $innerMarkup = false) 
    {
        if (isset($nodes) && count($nodes) == 1 && $nodes[0] instanceof DOMDOCUMENT) {
            $nodes = null;
        }
        if (isset($nodes)) {
            $markup = '';
            if (!is_array($nodes) && !($nodes instanceof DOMNODELIST) ) {
                $nodes = array($nodes);
            }
            if ($this->isDocumentFragment && ! $innerMarkup) {
                foreach($nodes as $i => $node) {
                    if ($node->isSameNode($this->root)) {
                        //    var_dump($node);
                        $nodes = array_slice($nodes, 0, $i)
                        + phpQuery::DOMNodeListToArray($node->childNodes)
                        + array_slice($nodes, $i+1);
                    }
                }
            }
            if ($this->isXML && ! $innerMarkup) {
                self::debug("Getting outerXML with charset '{$this->charset}'");
                // we need outerXML, so we can benefit from
                // $node param support in saveXML()
                foreach($nodes as $node) {
                    $markup .= $this->document->saveXML($node);
                }
            } else {
                $loop = array();
                if ($innerMarkup) {
                    foreach($nodes as $node) {
                        if ($node->childNodes) {
                            foreach($node->childNodes as $child) {
                                $loop[] = $child;
                            } 
                        } else {
                                        $loop[] = $node;
                        }
                    }
                } else {
                    $loop = $nodes;
                }
                self::debug("Getting markup, moving selected nodes (".count($loop).") to new DocumentFragment");
                $fake = $this->documentFragmentCreate($loop);
                $markup = $this->documentFragmentToMarkup($fake);
            }
            if ($this->isXHTML) {
                self::debug("Fixing XHTML");
                $markup = self::markupFixXHTML($markup);
            }
            self::debug("Markup: ".substr($markup, 0, 250));
            return $markup;
        } else {
            if ($this->isDocumentFragment) {
                // documentFragment, html only...
                self::debug("Getting markup, DocumentFragment detected");
                //                return $this->markup(
                ////                    $this->document->getElementsByTagName('body')->item(0)
                //                    $this->document->root, true
                //                );
                $markup = $this->documentFragmentToMarkup($this);
                // no need for markupFixXHTML, as it's done thought markup($nodes) method
                return $markup;
            } else {
                self::debug("Getting markup (".($this->isXML?'XML':'HTML')."), final with charset '{$this->charset}'");
                $markup = $this->isXML
                ? $this->document->saveXML()
                : $this->document->saveHTML();
                if ($this->isXHTML) {
                    self::debug("Fixing XHTML");
                    $markup = self::markupFixXHTML($markup);
                }
                self::debug("Markup: ".substr($markup, 0, 250));
                return $markup;
            }
        }
    }
460033
protected function renderMarkdown()
    {
        $markdownFileBuilder = new MarkdownFileBuilder($this->filesystem, $this->viewFactory, $this->file, $this->viewsData);

        return $markdownFileBuilder->render();
    }
141673
def handle_markdown(value):
    md = markdown(
        value,
        extensions=[
            'markdown.extensions.fenced_code',
            'codehilite',
        ]
    )
    
    open_tag = '<p>'
    close_tag = '</p>'
    if md.startswith(open_tag) and md.endswith(close_tag):
        md = md[len(open_tag):-len(close_tag)]
    return mark_safe(md)
319518
function parseMarkdown (markdownContent) {
  var codeBlocks =  markdownContent

  .split('```')

  .filter(function (codeBlock, index) {

    // Delete the text in between code sections
    if (index % 2 === 0 ||

        // Remove non JavaScript and JSON code blocks
        (codeBlock.trim().toLowerCase().indexOf('js')         !== 0 &&
         codeBlock.trim().toLowerCase().indexOf('javascript') !== 0)) {
      return false;
    }
    return true;
  })

  .map(function (codeBlock) {
    return {
      lang: codeBlock.split('\n')[0].trim().toLowerCase(),
      code: codeBlock.slice(codeBlock.indexOf('\n') + 1)
    };
  });

  return codeBlocks;
}
633468
function handleTag_br() {
    $this->out("  \n".$this->indent, true);
    $this->parser->html = ltrim($this->parser->html);
  }
553273
protected function handleTag_li()
    {
        if ($this->parent() == 'ol') {
            $parent =& $this->getStacked('ol');
            if ($this->parser->isStartTag) {
                $parent['num']++;
                $this->out(str_repeat(' ', 3 - strlen($parent['num'])) . $parent['num'] . '. ', true);
            }
        } else {
            if ($this->parser->isStartTag) {
                $this->out('  * ', true);
            }
        }
        $this->indent('    ', false);
        if (!$this->parser->isStartTag) {
            $this->setLineBreaks(1);
        }
    }
1266846
protected function markupDeclaration() {
        if ($this->scanner->current() != '!') {
            return false;
        }

        $tok = $this->scanner->next();

        // Comment:
        if ($tok == '-' && $this->scanner->peek() == '-') {
            $this->scanner->next(); // Consume the other '-'
            $this->scanner->next(); // Next char.
            return $this->comment();
        } elseif ($tok == 'D' || $tok == 'd') { // Doctype
            return $this->doctype('');
        } elseif ($tok == '[') { // CDATA section
            return $this->cdataSection();
        }

        // FINISH
        $this->parseError("Expected <!--, <![CDATA[, or <!DOCTYPE. Got <!%s", $tok);
        $this->bogusComment('<!');
        return true;
    }
499181
private function tag_close($tag)
	{
		if(!$this->current_tag instanceof Node_Container_Document
			&& $tag !== $this->current_tag->tag())
		{
			$closing_tags = $this->bbcodes[$this->current_tag->tag()]->closing_tags();

			if(in_array($tag, $closing_tags) || in_array('/' . $tag, $closing_tags))
				$this->current_tag = $this->current_tag->parent();
		}

		if($this->current_tag instanceof Node_Container_Document)
			return false;
		else if($tag !== $this->current_tag->tag())
		{
			// check if this is a tag inside another tag like
			// [tag1] [tag2] [/tag1] [/tag2]
			$node = $this->current_tag->find_parent_by_tag($tag);

			if($node !== null)
			{
				$this->current_tag = $node->parent();

				while(($node = $node->last_tag_node()) !== null)
				{
					$new_node = new Node_Container_Tag($node->tag(), $node->attributes());
					$this->current_tag->add_child($new_node);
					$this->current_tag = $new_node;
				}
			}
			else
				return false;
		}
		else
			$this->current_tag = $this->current_tag->parent();

		return true;
	}
901503
public function isValid($tag)
    {
        if (strlen($this->tagPrefix) > 0 && strpos($tag, $this->tagPrefix) !== 0) {
            return false;
        }

        return preg_match('/^' . $this->regex . '$/', substr($tag, strlen($this->tagPrefix))) == 1;
    }
1358051
protected function registerMarkdown()
    {
        $this->app->singleton('markdown', function (Container $app) {
            $environment = $app['markdown.environment'];
            $docParser = new DocParser($environment);
            $htmlRenderer = new HtmlRenderer($environment);

            return new Converter($docParser, $htmlRenderer);
        });

        $this->app->alias('markdown', Converter::class);
        $this->app->alias('markdown', ConverterInterface::class);
    }
1172991
protected function isHTML()
    {
        if (function_exists('headers_list') && $headers = headers_list())
        {
            foreach ((array) $headers as $header)
            {
                $header = strtolower($header);

                if (strpos($header, 'content-type:') === 0 && !strpos($header, 'text/html'))
                {
                    return false;
                }
            }
        }

        return true;
    }