(self, root)
Find code blocks and store in htmlStash.
Find code blocks and store in htmlStash.
Find code blocks and store in htmlStash .
def run(self, root):
        """ Find code blocks and store in htmlStash. """
        blocks = root.getiterator('pre')
        for block in blocks:
            children = block.getchildren()
            if len(children) == 1 and children[0].tag == 'code':
                code = CodeHilite(children[0].text,
                            linenos=self.config['force_linenos'],
                            guess_lang=self.config['guess_lang'],
                            css_class=self.config['css_class'],
                            style=self.config['pygments_style'],
                            noclasses=self.config['noclasses'],
                            tab_length=self.markdown.tab_length)
                placeholder = self.markdown.htmlStash.store(code.hilite(),
                                                            safe=True)
                # Clear codeblock in etree instance
                block.clear()
                # Change to p element which will later
                # be removed when inserting raw html
                block.tag = 'p'
                block.text = placeholder
def run ( self , root ) : blocks = root . getiterator ( 'pre' ) for block in blocks : children = block . getchildren ( ) if len ( children ) == 1 and children [ 0 ] . tag == 'code' : code = CodeHilite ( children [ 0 ] . text , linenos = self . config [ 'force_linenos' ] , guess_lang = self . config [ 'guess_lang' ] , css_class = self . config [ 'css_class' ] , style = self . config [ 'pygments_style' ] , noclasses = self . config [ 'noclasses' ] , tab_length = self . markdown . tab_length ) placeholder = self . markdown . htmlStash . store ( code . hilite ( ) , safe = True ) # Clear codeblock in etree instance block . clear ( ) # Change to p element which will later # be removed when inserting raw html block . tag = 'p' block . text = placeholder