Editorial Workflows

Auto Numbered Footnote

public 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: Inserts a Markdown footnote without changing the current cursor position. The footnote tag is auto generated based on current date/time stamp to ensure there is no overlap with other tags for sites using the Bigfoot.js plugin. Footnotes are are placed sequentially, based on existing footnotes in the document.

Based on original 'Insert Footnote...' work flow.

Shared by: @MyGeekDaddy

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Run Python Script ?
Source Code
#coding: utf-8
import editor
import workflow
import re

def get_next_footnote():
	text = editor.get_text(True)
	footnotes = set(re.findall('\[\^(.*?)\]', text))
	max_footnote = 0
	for fn in footnotes:
			fn_num = int(fn)
			max_footnote = max(max_footnote, fn_num)
		except ValueError:
	return str(max_footnote+1)

Set Variable ?
Variable Name
Footnote Name
Year: 2001Month: 01Day: 01Hour: 01 (24h)Minute: 01Second: 01
Request Text Input ?
Insert Footnote...
Initial Text
Text for footnote Footnote Name
  • Single Line
  • Multiple Lines
Keyboard Options:
Run Python Script ?
Source Code
#coding: utf-8
import workflow
import editor

text = editor.get_text()
cursor = editor.get_selection()[0]
fn_name = workflow.get_variable('Footnote Name')
fn_text = workflow.get_input()

footnote_def = '[^%s]: %s' % (fn_name, fn_text)
footnote_marker = '[^%s]' % (fn_name,)
end = len(text)
editor.replace_text(end, end, '\n\n' + footnote_def, False)
editor.replace_text(cursor, cursor, footnote_marker, False)