Ejemplo n.º 1
0
 def top_image(self):
     """
     Return the top image
     Return the image url if exists, or it will get the first image
     Will get the first image from the markdown
     """
     if self.featured_image:
         return self.featured_image
     elif self.content:
         md_images = wp_markdown.extract_images(self.content)
         return md_images[0] if md_images else None
Ejemplo n.º 2
0
#Header Kila
I see what you did here

#Header Nice
###Kite li anle

**this is some markdown**

blah blah blah
![image here](http://somewebsite.com/image1.jpg)
![another image here](http://anotherwebsite.com/image2.jpg)
'''

print wp_markdown.html(data, lazy_images=True)

print wp_markdown.extract_images(data)

print wp_markdown.toc(data)
exit()

import markdown
from markdown.treeprocessors import Treeprocessor
from markdown.extensions import Extension

# First create the treeprocessor

class ImgExtractor(Treeprocessor):
    def run(self, doc):
        "Find all images and append to markdown.images. "
        self.markdown.images = []
        for image in doc.findall('.//img'):