For when you do want, for any reason, to export a Bike file to Markdown, one route, which could be packaged in utilties like Keyboard Maestro etc, is through a Pandoc command line like:
pandoc -f html -t commonmark someFile.bike --lua-filter=noGap.lua
Where the contents of noGap.lua
(pruning empty bullets, dropping inline Div
or Span
tags, converting highlighting to inline ==
markup, converting strikethrough to inline ~~
markup) might be something like:
Expand disclosure triangle to view Lua source
function BulletList(x)
return pandoc.BulletList(
x.content:filter(
function(xs) return nil ~= next(xs) end
)
)
end
function Div(x)
return x.content
end
function Span(x)
if "mark" == x.classes[1] then
if FORMAT:match 'docx' then
x.attributes['custom-style'] = 'MarkYellow'
elseif FORMAT:match '^.*mark' then
return {
pandoc.Str(
"==" .. pandoc.utils.stringify(
x.content
) .. "=="
)
}
else
print("FORMAT unhandled for highlight: '" .. FORMAT .. "'. Ask.")
end
end
return x
end
function Strikeout(x)
-- This is just an alternative to flanking MD text
-- with <s> .. </s> (See, for example iAWriter MD)
if FORMAT:match '^.*mark' then
return pandoc.Str(
"~~" .. pandoc.utils.stringify(
x.content
) .. "~~"
)
else
return x
end
end
See also sketches like:
Draft demos: Copy As Markdown & Save As Markdown - Bike - Hog Bay Software Support