Change to markdown2
This commit is contained in:
		
							parent
							
								
									0f4dbd62f4
								
							
						
					
					
						commit
						cabe5b632f
					
				
							
								
								
									
										12
									
								
								crater.py
								
								
								
								
							
							
						
						
									
										12
									
								
								crater.py
								
								
								
								
							| 
						 | 
				
			
			@ -8,7 +8,7 @@ from watchdog.events import FileSystemEventHandler
 | 
			
		|||
from jinja2 import Environment, FileSystemLoader, select_autoescape
 | 
			
		||||
import yaml
 | 
			
		||||
import frontmatter
 | 
			
		||||
import markdown
 | 
			
		||||
import markdown2
 | 
			
		||||
import fire
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -95,11 +95,11 @@ def crater(prod=False):
 | 
			
		|||
                "content", "public").rstrip(".md")
 | 
			
		||||
            os.makedirs(post_path, exist_ok=True)
 | 
			
		||||
 | 
			
		||||
            description = post_data.content.partition('<!--more-->')[0]
 | 
			
		||||
            content = "{% import 'shortcodes.j2' as shortcodes %}" + \
 | 
			
		||||
                markdown.markdown(post_data.content)
 | 
			
		||||
 | 
			
		||||
            content = templates.from_string(content).render()            
 | 
			
		||||
            content = markdown2.markdown(post_data.content, extras=['fenced-code-blocks'])
 | 
			
		||||
            description = content.partition('<!--more-->')[0]
 | 
			
		||||
            content = "{% import 'shortcodes.j2' as shortcodes %}" + content
 | 
			
		||||
 | 
			
		||||
            url = post_path.replace(f"public/{language}", "")
 | 
			
		||||
            section = "/" if len(url.split('/')) == 2 else url.split('/')[1]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -109,7 +109,7 @@ def crater(prod=False):
 | 
			
		|||
                'title': post_data['title'],
 | 
			
		||||
                'description': description,
 | 
			
		||||
                'date': post_data['date'],
 | 
			
		||||
                'content': content
 | 
			
		||||
                'content': templates.from_string(content).render()
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            image = post_data.get('image', None)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +1,15 @@
 | 
			
		|||
altgraph==0.17.3
 | 
			
		||||
fire==0.5.0
 | 
			
		||||
Jinja2==3.1.2
 | 
			
		||||
Markdown==3.4.3
 | 
			
		||||
markdown2==2.4.9
 | 
			
		||||
MarkupSafe==2.1.3
 | 
			
		||||
Pygments==2.15.1
 | 
			
		||||
pyinstaller==5.13.0
 | 
			
		||||
pyinstaller-hooks-contrib==2023.6
 | 
			
		||||
python-frontmatter==1.0.0
 | 
			
		||||
PyYAML==6.0.1
 | 
			
		||||
six==1.16.0
 | 
			
		||||
svgwrite==1.4.3
 | 
			
		||||
termcolor==2.3.0
 | 
			
		||||
watchdog==3.0.0
 | 
			
		||||
wavedrom==2.0.3.post3
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue