# File lib/maruku/input/parse_doc.rb, line 190
        def substitute_markdown_inside_raw_html
                self.each_element(:raw_html) do |e|
                        doc = e.instance_variable_get :@parsed_html
                        if doc # valid html
                                # parse block-level markdown elements in these HTML tags
                                block_tags = ['div']

                                # use xpath to find elements with 'markdown' attribute
                                XPath.match(doc, "//*[attribute::markdown]" ).each do |e|
#                                       puts "Found #{e}"
                                        # should we parse block-level or span-level?
                                        parse_blocks = (e.attributes['markdown'] == 'block') || 
                                                       block_tags.include?(e.name)
                                        # remove 'markdown' attribute
                                        e.delete_attribute 'markdown'
                                        # Select all text elements of e
                                        XPath.match(e, "//text()" ).each { |original_text| 
                                                s = original_text.value.strip
                                                if s.size > 0
                                                        el = md_el(:dummy,
                                                                 parse_blocks ? parse_text_as_markdown(s) :
                                                                          parse_lines_as_span([s]) )
                                                        p = original_text.parent
                                                        el.children_to_html.each do |x|
                                                                p.insert_before(original_text, x)
                                                        end
                                                        p.delete(original_text)
                                                        
                                                end
                                        }
                                                
                                end
                                
                        end
                end
        end