This would be awesome, and would completely solve the problem for me! Thanks again.
Sounds good! I realize this is low priority In any case it sounds like complexpoint is planning to share a script that will solve the problem for my use case (I don’t use KeyboardMaestro, but I do use pandoc). Thanks for the great work you do!
A first draft of a Pandoc reader for Bike seems to be working, with:
Top N levels as headings
- Specific level(s) → flat
Para
(rather than indentedBulletList
) - automatic closing-up of empty (unordered list – bullet) lines.
I haven’t yet implemented:
- Successive completely
Code
-formatted lines →Pandoc CodeBlock
, or - Successive (
>
prefixed ?) lines →Pandoc BlockQuote
Are there any other Bike → Pandoc mappings that might help ?
- Rows with numeric prefixes → Pandoc
OrderedList
? - Optional preservation of empty lines, but without bullets ?
- *** → Pandoc
HorizontalRule
?
Anything else ?
Wonderful!
I think the main additional mapping that comes up a lot in my use case (lecture notes and handouts for academic lectures/talks) and would be very helpful is
- Rows with numeric prefixes → Pandoc OrderedList
Quotes would also be fantastic, and using > prefixing makes a lot of sense to me (in part because markdown is so ubiquitous)
Many thanks!
I’ll take a look this weekend.
I would love to see this script also handling hyperlinks
In the meanwhile, if you just want a markdown file which is a simple bulleted outline, but with markdown links, you can install Pandoc, and use a command line like:
pandoc -f html -t commonmark someFile.bike --lua-filter=vanilla.lua > someFile.md
where vanilla.lua
(which mainly strips out id annotations, and adjusts the export of highlights and strikethroughs) should be a file containing the following lua script:
Expand disclosure triangle to view Lua source
-- Shedding empty lines
function BulletList(x)
return pandoc.BulletList(
x.content:filter(
function(xs) return nil ~= next(xs) end
)
)
end
-- Shedding any Div wrappers
function Div(x)
return x.content
end
-- Optional MD version of Highlight
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
) .. "=="
)
}
end
end
return x
end
-- Optional MD version of Strikeout
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
Export the markdown of some selected bike files to a specific location with one click.
Thanks for your code that made my workflow possible.
tips:
The default location of pandoc filters is under here. creat the file so you can use .lua directly without the path.
/Users/yourname/.local/share/pandoc/filters/vanilla.lua