Editorial Workflows

Custom Preview

unlisted workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: A customized Markdown preview that doesn't display mmd-style metadata.

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Document Text ?
Folded Text
  • Include
  • Replace with:
Run Python Script ?
Source Code
#coding: utf-8
import workflow
from markdown2 import markdown
import re
text = workflow.get_input()

#Check if the document starts with metadata:
if re.match('^\\w+:', text):
	#Find the first empty line:
	empty_line_match = re.search('^\\s*$', text, re.MULTILINE)
	if empty_line_match:
		#Remove the metadata block from the text:
		text = text[empty_line_match.end(0):]
html = markdown(text, extras=['footnotes'])
workflow.set_output(html)
Show HTML ?
HTML
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style> body { margin: 0; padding: 0; border: 0; color: #333; font-size: 18px; font-family: "Source Sans Pro", Helvetica, sans-serif; line-height: 150%; vertical-align: baseline; overflow:hidden; background-color: #fafafa; } a { color: #096ba1; text-decoration:none; } h1 { font-size: 27px; margin-top: 32px; margin-bottom: 12px; } h2 { font-size: 24px; margin-top: 32px; margin-bottom: 12px; } h3 { font-size: 22px; } h4, h5, h6 { font-size: 20px; margin-top: 12px; margin-bottom: 0; } h1:first-child { margin-top: 0; } p { margin-bottom: 12px; } p:last-child { margin-bottom:0; } ol { list-style: outside decimal; } ul { list-style: outside disc; } ol, ul { padding-left:0; margin-bottom:12px; } ol li { margin-bottom:16px; margin-left:28px; } ul li { margin-bottom: 12px; margin-left: 20px; } ol:last-child, ul:last-child { margin-bottom:0; } li > p { margin-bottom:12px; } li > ol, li > ul { margin-top: 12px !important; padding-left:12px; } dl { margin-bottom: 12px; } dl dt { font-weight:bold; margin-bottom: 8px; } dl dd { margin-left: 0; margin-bottom: 12px; } dl dd:last-child, dl:last-child { margin-bottom: 0; } pre { white-space: pre-wrap; margin-bottom: 24px; overflow: hidden; padding: 3px; -webkit-border-radius: 3px; background-color: #f5f5f5 border: 1px solid #e0e0e0; } code { font-family: "DejaVuSansMono", monospace; font-size: 0.9em; white-space: nowrap; padding: 2px; -webkit-border-radius: 4px; background-color: #f5f5f5; border: 1px solid #e0e0e0; } pre code { font-family: "DejaVuSansMono", monospace; white-space: pre-wrap; border: none; padding: 0; background-color: transparent; -webkit-border-radius: 0; } blockquote { border-left: 3px solid #ccc; margin-left: 0; margin-right: auto; width: 95%; padding: 0 10px; } table { margin-left: auto; margin-right: auto; margin-bottom: 24px; border-bottom: 1px solid #ddd; border-right: 1px solid #ddd; border-spacing: 0; } table th { padding: 3px 10px; background-color: #f9f9f9; border-top: 1px solid #ddd; border-left: 1px solid #ddd; } table tr { } table td { padding: 3px 10px; border-top: 1px solid #ddd; border-left: 1px solid #ddd; } caption { font-size: 1.2em; font-weight: bold; margin-bottom: 5px; } figure { display: block; text-align: center; } img { border: none; display: block; margin: 1em auto; max-width: 100%; } figcaption { font-size: 0.8em; font-style: italic; } mark { background: #fefec0; padding:1px 3px; } #content-wrapper { height: 100%; overflow-y: scroll; overflow-x: hidden; font-size: 1.0em; width: 100%; } #content { width: auto; padding: 40px 40px 40px 40px; } .markdowncitation { } .footnote { font-size: 0.8em; vertical-align: super; } .footnotes ol { font-weight: bold; } .footnotes ol li p { font-weight: normal; } </style> </head> <body> <div id="content-wrapper"> <div id="content"> Input </div> </div> </body> </html>
Title
Preview
Base URL
None