Generate HTML representation of the markdown-formatted blog entry,
        and also convert any media URLs into rich media objects such as video
        players or images.
503165
def html_content(self):
        
        hilite = CodeHiliteExtension(linenums=False, css_class='highlight')
        extras = ExtraExtension()
        markdown_content = markdown(self.content, extensions=[hilite, extras])
        oembed_content = parse_html(
            markdown_content,
            oembed_providers,
            urlize_all=True,
            maxwidth=app.config['SITE_WIDTH'])
        return Markup(oembed_content)
273653
def generate(self):
        
        generated_content = ''
        if 'published' in (self._config['status'][0]).lower():
            if os.path.isdir(self.dirs['www_dir']):
                shutil.rmtree(self.dirs['www_dir'])
            os.mkdir(self.dirs['www_dir'])
            # copy the whole source directory of the page,
            # excluding 'nowww' and *s2md
            sfl = glob.glob(os.path.join(self.dirs['source_dir'], "*"))
            dirlist = [f for f in sfl if os.path.isdir(f)]
            filelist = [f for f in sfl if os.path.isfile(f)]
            for f in filelist:
                if not '.md' in os.path.split(f)[1]:
                    shutil.copy(f, self.dirs['www_dir'])
            for d in dirlist:
                rfn = os.path.split(d)[1]
                if rfn != 'nowww':
                    shutil.copytree(d, os.path.join(self.dirs['www_dir'], rfn))
                #write the rendered "page" to file

            #fout = open(self.dirs['www_filename'], 'w')
            #fout.write(self.render())
            #fout.close()

            generated_content = self.render()
            fout = codecs.open(self.dirs['www_filename'], "w", encoding="utf-8", errors="xmlcharrefreplace")
            fout.write(generated_content)
            fout.close()

        return generated_content
144338
def html(self, text=TEXT):
        
        self.logger.debug("Generating the HTML report{}..."
                          .format(["", " (text only)"][text]))
        html = []
        for piece in self._pieces:
            if isinstance(piece, string_types):
                html.append(markdown2.markdown(piece, extras=["tables"]))
            elif isinstance(piece, Element):
                html.append(piece.html())
        return "\n\n".join(html)
1291053
def generate_html():
    
    html_file = open(html_filename, "w")
    html_file.write("<html><body>")
    html_file.write("<h1>Here are some graphs for you!</h1>")
    for image in [lines_filename, bars_filename, histogram_filename]:
        html_file.write("<div><h2>{0}</h2><img src='{0}' /></div>".format(image))
    html_file.write("</body></html>")
    html_file.close()
687645
def with_mhtml(css, asset_url)
      paths, index = {}, 0
      css = css.gsub(EMBED_REPLACER) do |url|
        i = paths[$1] ||= "#{index += 1}-#{File.basename($1)}"
        "url(mhtml:#{asset_url}!#{i})"
      end
      mhtml = paths.sort.map do |path, identifier|
        mime, contents = mime_type(path), encoded_contents(path)
        [MHTML_SEPARATOR, "Content-Location: #{identifier}\r\n", "Content-Type: #{mime}\r\n", "Content-Transfer-Encoding: base64\r\n\r\n", contents, "\r\n"]
      end
      [MHTML_START, mhtml, MHTML_END, css].flatten.join('')
    end
1215539
def _media(self):
        
        def static_url(url):
            return staticfiles_storage.url('zinnia_markitup/%s' % url)

        media = super(EntryAdminMarkItUpMixin, self).media

        media += Media(
            js=(static_url('js/jquery.min.js'),
                static_url('js/markitup/jquery.markitup.js'),
                static_url('js/markitup/sets/%s/set.js' % (
                    settings.MARKUP_LANGUAGE)),
                reverse('admin:zinnia_entry_markitup')),
            css={'all': (
                static_url('js/markitup/skins/django/style.css'),
                static_url('js/markitup/sets/%s/style.css' % (
                    settings.MARKUP_LANGUAGE)))}
        )
        return media
1167084
def simple_md2html(text, urls):
    '''  '''
    retval = special_links_replace(text, urls)
    # Create a par break for double newlines
    retval = re.sub(r'\n\n', r'</p><p>', retval)
    # Create a visual br for every new line
    retval = re.sub(r'\n', r'<br />\n', retval)
    # Do we really need this ? Help reduce the diff to only '\n' diff.
    retval = re.sub(r'"', r'&quot;', retval)
    retval = list2html(retval)
    return link2html(retval)
144262
def to_html(self, classes=None, notebook=False):
        
        html_renderer = HTMLFormatter(self, classes=classes,
                                      max_rows=self.max_rows,
                                      max_cols=self.max_cols,
                                      notebook=notebook)
        if hasattr(self.buf, 'write'):
            html_renderer.write_result(self.buf)
        elif isinstance(self.buf, six.string_types):
            with open(self.buf, 'w') as f:
                html_renderer.write_result(f)
        else:
            raise TypeError('buf is not a file name and it has no write '
                            ' method')
1090998
def rst2html(rst_src, **kwargs):
    
    pub = rst2pub(rst_src, settings_overrides=kwargs, writer_name='html')
    return pub.writer.parts['body']
789153
function md2html( file ){
  file = file.substr( file.length - 3 ) === '.md' ? file : file + '.md'; // add extension if need be

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

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

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

      return ret;
      
    },

    renderer: mdRend
  } );


  return html;
}
759970
def MarkDown(node):
    
    cur = node.first_child

    # Go into each child, in turn
    output = []
    while cur is not None:
        t = cur.t
        if t == 'paragraph':
            output.append(paragraph(cur))
        elif t == 'text':
            output.append(text(cur))
        elif t == 'softbreak':
            output.append(softbreak(cur))
        elif t == 'linebreak':
            output.append(hardbreak(cur))
        elif t == 'link':
            output.append(reference(cur))
        elif t == 'heading':
            output.append(title(cur))
        elif t == 'emph':
            output.append(emphasis(cur))
        elif t == 'strong':
            output.append(strong(cur))
        elif t == 'code':
            output.append(literal(cur))
        elif t == 'code_block':
            output.append(literal_block(cur))
        elif t == 'html_inline' or t == 'html_block':
            output.append(raw(cur))
        elif t == 'block_quote':
            output.append(block_quote(cur))
        elif t == 'thematic_break':
            output.append(transition(cur))
        elif t == 'image':
            output.append(image(cur))
        elif t == 'list':
            output.append(listNode(cur))
        elif t == 'item':
            output.append(listItem(cur))
        elif t == 'MDsection':
            output.append(section(cur))
        else:
            print('Received unhandled type: {}. Full print of node:'.format(t))
            cur.pretty()

        cur = cur.nxt

    return output
956248
def prepare(self):

        self.body_html = markdown(
            codecs.open(self.abspath, 'r').read(),
            extras=['fenced-code-blocks', 'hilite', 'tables', 'metadata'])

        self.header = self.body_html.metadata
        """"""
        if 'tags' in self.header:  # pages can lack tags
            self.header['tags'] = [t.strip().lower() for t in
                                   self.header['tags'].split(',')]

        else:
            self.header['tags'] = ("",)

        self.date = self.header.get('published', datetime.datetime.now())

        if isinstance(self.date, str):
            self.date = datetime.datetime.strptime(self.date, "%Y-%m-%d")

        for k, v in self.header.items():
            try:
                setattr(self, k, v)
            except AttributeError:
                pass

        if self.id:
            return

        rec = {'filename': self.path,
               'mtime': int(os.path.getmtime(self.abspath))}

        if self.header['kind'] == 'writing':
            _id = Entry.db.posts.insert(rec)

        elif self.header['kind'] == 'page':
            _id = Entry.db.pages.insert(rec)

        self.id = _id
971056
protected function prepareContent()
    {
        $html = $this->getHtmlContent();

        if (class_exists("\\DOMDocument")) {
            $doc = new \DOMDocument();
            $doc->loadHTML($html);
        } else {
            throw new \RuntimeException("Required extension 'dom' seems to be missing.");
        }

        // Extract styles and remove style tags (optionally added again later).
        //
        // IMPORTANT: The style nodes need to be saved in an array first, or
        //            the replacement won't work correctly.
        $styleString = "";
        $styleNodes = [];
        foreach($doc->getElementsByTagName('style') as $styleNode) {
            $styleNodes[] = $styleNode;
        }
        foreach($styleNodes as $styleNode) {
            $skip = false;

            // Check if type is 'text/css' (defaults to it if not)
            $typeAttribute = $styleNode->attributes->getNamedItem("type");
            if ($typeAttribute !== null && (string)$typeAttribute->nodeValue !== "text/css") {
                $skip = true;
            }

            // Check media type is allowed (defaults to 'all')
            if ($skip === false) {
                $mediaAttribute = $styleNode->attributes->getNamedItem("media");
                if ($mediaAttribute !== null) {
                    $mediaAttribute = str_replace(" ", "", (string)$mediaAttribute->nodeValue);
                    $mediaTypes = explode(",", $mediaAttribute);
                    if (!in_array("all", $mediaTypes) && !in_array("screen", $mediaTypes)) {
                        $skip = true;
                    }
                }
            }

            // Add CSS if allowed
            if ($skip === false) {
                $styleString .= $styleNode->nodeValue . "\r\n";
            }

            $styleNode->parentNode->removeChild($styleNode);
        }

        // Prepare some variables
        $xpath = new \DOMXpath($doc);
        $reader = new CssString($styleString);
        $reader->setEnvironmentEncoding($this->getCharset());
        $rules = $reader->getStyleSheet()->getRules();

        // Set pseudo classes that can be set in a style attribute
        // and that are supported by the Symfony CssSelector (doesn't support CSS4 yet).
        $allowedPseudoClasses = [
            StyleSelector::PSEUDO_CLASS_FIRST_CHILD,
            StyleSelector::PSEUDO_CLASS_ROOT,
            StyleSelector::PSEUDO_CLASS_NTH_CHILD,
            StyleSelector::PSEUDO_CLASS_NTH_LAST_CHILD,
            StyleSelector::PSEUDO_CLASS_NTH_OF_TYPE,
            StyleSelector::PSEUDO_CLASS_NTH_LAST_OF_TYPE,
            StyleSelector::PSEUDO_CLASS_LAST_CHILD,
            StyleSelector::PSEUDO_CLASS_FIRST_OF_TYPE,
            StyleSelector::PSEUDO_CLASS_LAST_OF_TYPE,
            StyleSelector::PSEUDO_CLASS_ONLY_CHILD,
            StyleSelector::PSEUDO_CLASS_ONLY_OF_TYPE,
            StyleSelector::PSEUDO_CLASS_EMPTY,
            StyleSelector::PSEUDO_CLASS_NOT,
        ];

        // Extract all relevant style declarations
        $selectors = [];
        foreach ($this->getRelevantStyleRules($rules) as $styleRule) {
            foreach ($styleRule->getSelectors() as $selector) {
                // Check if the selector contains pseudo classes/elements that cannot
                // be mapped to elements
                $skip = false;
                foreach($selector->getPseudoClasses() as $pseudoClass) {
                    if (!in_array($pseudoClass, $allowedPseudoClasses)) {
                        $skip = true;
                        break;
                    }
                }
                if ($skip === false) {
                    $specificity = $selector->getSpecificity();
                    if (!isset($selectors[$specificity])) {
                        $selectors[$specificity] = [];
                    }
                    $selectorString = $selector->getValue();
                    if (!isset($selectors[$specificity][$selectorString])) {
                        $selectors[$specificity][$selectorString] = [];
                    }
                    foreach ($styleRule->getDeclarations() as $declaration) {
                        $selectors[$specificity][$selectorString][] = $declaration;
                    }
                }
            }
        }

        // Get all specificity values (to process the declarations in the correct order,
        // without sorting the array by key, which perhaps could result in a changed
        // order of selectors within the specificity).
        $specificityKeys = array_keys($selectors);
        sort($specificityKeys);

        // Temporary remove all existing style attributes, because they always have the highest priority
        // and are added again after all styles have been applied to the elements
        $elements = $xpath->query("descendant-or-self::*[@style]");
        /** @var \DOMElement $element */
        foreach ($elements as $element) {
            if ($element->attributes !== null) {
                $styleAttribute = $element->attributes->getNamedItem("style");

                $styleValue = "";
                if ($styleAttribute !== null) {
                    $styleValue = (string)$styleAttribute->nodeValue;
                }

                if ($styleValue !== "") {
                    $element->setAttribute('data-pre-mailer-original-style', $styleValue);
                    $element->removeAttribute('style');
                }
            }
        }

        // Process all style declarations in the correct order
        foreach ($specificityKeys as $specificityKey) {
            /** @var StyleDeclaration[] $declarations */
            foreach ($selectors[$specificityKey] as $selectorString => $declarations) {
                $xpathQuery = CssSelector::toXPath($selectorString);
                $elements = $xpath->query($xpathQuery);
                /** @var \DOMElement $element */
                foreach ($elements as $element) {
                    if ($element->attributes !== null) {
                        $styleAttribute = $element->attributes->getNamedItem("style");

                        $styleValue = "";
                        if ($styleAttribute !== null) {
                            $styleValue = (string)$styleAttribute->nodeValue;
                        }

                        $concat = ($styleValue === "") ? "" : ";";
                        foreach ($declarations as $declaration) {
                            $styleValue .= $concat . $declaration->getProperty() . ":" . $declaration->getValue();
                            $concat = ";";
                        }

                        $element->setAttribute('style', $styleValue);
                    }
                }
            }
        }

        // Add temporarily removed style attributes again, after all styles have been applied to the elements
        $elements = $xpath->query("descendant-or-self::*[@data-pre-mailer-original-style]");
        /** @var \DOMElement $element */
        foreach ($elements as $element) {
            if ($element->attributes !== null) {
                $styleAttribute = $element->attributes->getNamedItem("style");
                $styleValue = "";
                if ($styleAttribute !== null) {
                    $styleValue = (string)$styleAttribute->nodeValue;
                }

                $originalStyleAttribute = $element->attributes->getNamedItem("data-pre-mailer-original-style");
                $originalStyleValue = "";
                if ($originalStyleAttribute !== null) {
                    $originalStyleValue = (string)$originalStyleAttribute->nodeValue;
                }

                if ($styleValue !== "" || $originalStyleValue !== "") {
                    $styleValue = ($styleValue !== "" ? $styleValue . ";" : "") . $originalStyleValue;
                    $element->setAttribute('style', $styleValue);
                    $element->removeAttribute('data-pre-mailer-original-style');
                }
            }
        }

        // Optionally remove class attributes in HTML tags
        $optionHtmlClasses = $this->getOption(self::OPTION_HTML_CLASSES);
        if ($optionHtmlClasses === self::OPTION_HTML_CLASSES_REMOVE) {
            $nodesWithClass = [];
            foreach ($xpath->query('descendant-or-self::*[@class]') as $nodeWithClass) {
                $nodesWithClass[] = $nodeWithClass;
            }
            /** @var \DOMElement $nodeWithClass */
            foreach ($nodesWithClass as $nodeWithClass) {
                $nodeWithClass->removeAttribute('class');
            }
        }

        // Optionally remove HTML comments
        $optionHtmlComments = $this->getOption(self::OPTION_HTML_COMMENTS);
        if ($optionHtmlComments === self::OPTION_HTML_COMMENTS_REMOVE) {
            $commentNodes = [];
            foreach ($xpath->query('//comment()') as $comment) {
                $commentNodes[] = $comment;
            }
            foreach ($commentNodes as $commentNode) {
                $commentNode->parentNode->removeChild($commentNode);
            }
        }

        // Write XPath document back to DOM document
        $newDoc = $xpath->document;

        // Generate text version (before adding the styles again)
        $this->text = $this->prepareText($newDoc);

        // Optionally add styles tag to the HEAD or the BODY of the document
        $optionStyleTag = $this->getOption(self::OPTION_STYLE_TAG);
        if ($optionStyleTag === self::OPTION_STYLE_TAG_BODY || $optionStyleTag === self::OPTION_STYLE_TAG_HEAD) {
            $cssWriterClass = $this->getOption(self::OPTION_CSS_WRITER_CLASS);
            /** @var WriterAbstract $cssWriter */
            $cssWriter = new $cssWriterClass($reader->getStyleSheet());
            $styleNode = $newDoc->createElement("style");
            $styleNode->nodeValue = $cssWriter->getContent();

            if ($optionStyleTag === self::OPTION_STYLE_TAG_BODY) {
                /** @var \DOMNode $bodyNode */
                foreach($newDoc->getElementsByTagName('body') as $bodyNode) {
                    $bodyNode->insertBefore($styleNode, $bodyNode->firstChild);
                    break;
                }
            } elseif ($optionStyleTag === self::OPTION_STYLE_TAG_HEAD) {
                /** @var \DOMNode $headNode */
                foreach($newDoc->getElementsByTagName('head') as $headNode) {
                    $headNode->appendChild($styleNode);
                    break;
                }
            }
        }

        // Generate HTML version
        $this->html = $newDoc->saveHTML();
    }
287604
def generate_html(attrs, api_key):
    '''  '''
    # getting flickr api data
    flickr_data = get_info(attrs['photo_id'], api_key)

    # if size is not defined it will use large as image size
    if 'size' not in attrs.keys():
        attrs['size'] = 'large'

    # if no alt is defined it will use the flickr image title
    if 'alt' not in attrs.keys():
        attrs['alt'] = flickr_data['photo']['title']['_content']

    # return final html code
    return '<a href="{}"><img src="{}" alt="{}"></a>'.format(
        flickr_data['photo']['urls']['url'][0]['_content'],
        source_url(flickr_data['photo']['farm'],
                   flickr_data['photo']['server'],
                   attrs['photo_id'],
                   flickr_data['photo']['secret'],
                   attrs['size']),
        attrs['alt'])
679875
def render_html(self, *args, **kwargs):
        
        static_url = '%s://%s%s' % (self.request.scheme, self.request.get_host(), settings.STATIC_URL)
        media_url = '%s://%s%s' % (self.request.scheme, self.request.get_host(), settings.MEDIA_URL)

        with override_settings(STATIC_URL=static_url, MEDIA_URL=media_url):
            template = loader.get_template(self.template_name)
            context = self.get_context_data(*args, **kwargs)
            html = template.render(context)
            return html
1255617
function(source, id, url) {
            module.debug('Generating embed html');
            var
              width = (settings.width == 'auto')
                ? $module.width()
                : settings.width,
              height = (settings.height == 'auto')
                ? $module.height()
                : settings.height,
              html
            ;
            if(source && id) {
              if(source == 'vimeo') {
                html = ''
                  + '<iframe src="http://player.vimeo.com/video/' + id + '?=' + module.generate.url(source) + '"'
                  + ' width="' + width + '" height="' + height + '"'
                  + ' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'
                ;
              }
              else if(source == 'youtube') {
                html = ''
                  + '<iframe src="http://www.youtube.com/embed/' + id + '?=' + module.generate.url(source) + '"'
                  + ' width="' + width + '" height="' + height + '"'
                  + ' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'
                ;
              }
            }
            else if(url) {
              html = ''
                + '<iframe src="' + url + '"'
                + ' width="' + width + '" height="' + height + '"'
                + ' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'
              ;
            }
            else {
              module.error(error.noVideo);
            }
            return html;
          }
1109189
def _markdownify(tag, _listType=None, _blockQuote=False, _listIndex=1):
	""""""
	children = tag.find_all(recursive=False)

	if tag.name == '[document]':
		for child in children:
			_markdownify(child)
		return

	if tag.name not in _supportedTags or not _supportedAttrs(tag):
		if tag.name not in _inlineTags:
			tag.insert_before('\n\n')
			tag.insert_after('\n\n')
		else:
			_escapeCharacters(tag)
			for child in children:
				_markdownify(child)
		return
	if tag.name not in ('pre', 'code'):
		_escapeCharacters(tag)
		_breakRemNewlines(tag)
	if tag.name == 'p':
		if tag.string != None:
			if tag.string.strip() == u'':
				tag.string = u'\xa0'
				tag.unwrap()
				return
		if not _blockQuote:
			tag.insert_before('\n\n')
			tag.insert_after('\n\n')
		else:
			tag.insert_before('\n')
			tag.insert_after('\n')
		tag.unwrap()

		for child in children:
			_markdownify(child)
	elif tag.name == 'br':
		tag.string = '  \n'
		tag.unwrap()
	elif tag.name == 'img':
		alt = ''
		title = ''
		if tag.has_attr('alt'):
			alt = tag['alt']
		if tag.has_attr('title') and tag['title']:
			title = ' "%s"' % tag['title']
		tag.string = '![%s](%s%s)' % (alt, tag['src'], title)
		tag.unwrap()
	elif tag.name == 'hr':
		tag.string = '\n---\n'
		tag.unwrap()
	elif tag.name == 'pre':
		tag.insert_before('\n\n')
		tag.insert_after('\n\n')
		if tag.code:
			if not _supportedAttrs(tag.code):
				return
			for child in tag.code.find_all(recursive=False):
				if child.name != 'br':
					return
			# code block
			for br in tag.code.find_all('br'):
				br.string = '\n'
				br.unwrap()
			tag.code.unwrap()
			lines = unicode(tag).strip().split('\n')
			lines[0] = lines[0][5:]
			lines[-1] = lines[-1][:-6]
			if not lines[-1]:
				lines.pop()
			for i,line in enumerate(lines):
				line = line.replace(u'\xa0', ' ')
				lines[i] = '    %s' % line
			tag.replace_with(BeautifulSoup('\n'.join(lines), 'html.parser'))
		return
	elif tag.name == 'code':
		# inline code
		if children:
			return
		tag.insert_before('`` ')
		tag.insert_after(' ``')
		tag.unwrap()
	elif _recursivelyValid(tag):
		if tag.name == 'blockquote':
			# ! FIXME: hack
			tag.insert_before('<<<BLOCKQUOTE: ')
			tag.insert_after('>>>')
			tag.unwrap()
			for child in children:
				_markdownify(child, _blockQuote=True)
			return
		elif tag.name == 'a':
			# process children first
			for child in children:
				_markdownify(child)
			if not tag.has_attr('href'):
				return
			if tag.string != tag.get('href') or tag.has_attr('title'):
				title = ''
				if tag.has_attr('title'):
					title = ' "%s"' % tag['title']
				tag.string = '[%s](%s%s)' % (BeautifulSoup(unicode(tag), 'html.parser').string,
					tag.get('href', ''),
					title)
			else:
				# ! FIXME: hack
				tag.string = '<<<FLOATING LINK: %s>>>' % tag.string
			tag.unwrap()
			return
		elif tag.name == 'h1':
			tag.insert_before('\n\n# ')
			tag.insert_after('\n\n')
			tag.unwrap()
		elif tag.name == 'h2':
			tag.insert_before('\n\n## ')
			tag.insert_after('\n\n')
			tag.unwrap()
		elif tag.name == 'h3':
			tag.insert_before('\n\n### ')
			tag.insert_after('\n\n')
			tag.unwrap()
		elif tag.name == 'h4':
			tag.insert_before('\n\n#### ')
			tag.insert_after('\n\n')
			tag.unwrap()
		elif tag.name == 'h5':
			tag.insert_before('\n\n##### ')
			tag.insert_after('\n\n')
			tag.unwrap()
		elif tag.name == 'h6':
			tag.insert_before('\n\n###### ')
			tag.insert_after('\n\n')
			tag.unwrap()
		elif tag.name in ('ul', 'ol'):
			tag.insert_before('\n\n')
			tag.insert_after('\n\n')
			tag.unwrap()
			for i, child in enumerate(children):
				_markdownify(child, _listType=tag.name, _listIndex=i+1)
			return
		elif tag.name == 'li':
			if not _listType:
				# <li> outside of list; ignore
				return
			if _listType == 'ul':
				tag.insert_before('*   ')
			else:
				tag.insert_before('%d.   ' % _listIndex)
			for child in children:
				_markdownify(child)
			for c in tag.contents:
				if type(c) != bs4.element.NavigableString:
					continue
				c.replace_with('\n    '.join(c.split('\n')))
			tag.insert_after('\n')
			tag.unwrap()
			return
		elif tag.name in ('strong','b'):
			tag.insert_before('__')
			tag.insert_after('__')
			tag.unwrap()
		elif tag.name in ('em','i'):
			tag.insert_before('_')
			tag.insert_after('_')
			tag.unwrap()
		for child in children:
			_markdownify(child)