Copy Paste and Save As between Birch and FT – two scripts


#1

A couple of Yosemite Javascript for Applications scripts which can be run from Script Editor or assigned to keystrokes with something like Keyboard Maestro.

  1. FoldingText / MD --> Birch outline
  2. Birch outline --> FoldingText MD format

Both can be used either for clipboard copy paste or for file system Open and Save As

(Probably makes sense to save two versions of each, adjusting the options switches at the top of each script to 0 or 1 values to select between clipboard and file operations)

Installation - paste the code into Yosemite Script Editor, setting the editor language option to Javascript, and save as a compiled .scpt file

(I have moved the source code from this thread to Github)


#4

I’ve updated the FTSaveAsBML script, adding

  • conversion of MD links to BML
  • handling of fenced code

Let me know if there is anything else that it doesn’t yet seem to be bringing across for you.

(The @tag and @key(value) elements and line types (header, code, quote etc) are being exported, and you will see them in the HTML. They will become directly visible and editable in one of Jesse’s forthcoming releases).


#5

Version 12 of this script now uses CommonMark AST (rather than FoldingText) line-type names, for compatibility with the birch-markdown package.


#6

Updated to Version 15 for compatibility with latest version of Birch.

(id of root list changed from Birch.Root to Birch)


#7

Updated the BML2MD script to format the output in MD according to any specific line-type indicated by a data-type attribute in the BML.

(Created, for example, with Jesse’s Birch-Markdown package, using:

ESC th    Header
ESC to    Ordered
ESC tu    Bullet ('unordered' the default)
ESC tc    CodeBlock
ESC tq    BlockQuote
ESC tp    Paragraph 

)


#8

Time for me to update these to FoldingText Markup Language and change the root ul id to “FoldingText”

Is there a preferred file extension, like .ftml, for example ?

EDIT:

Got it … .ftml it is … http://jessegrosjean.gitbooks.io/foldingtext-for-atom-user-s-guide/content/foldingtext_basics.html

( I was being slow )


#9

Updated both scripts to FTMD ⇄ FTML versions

  • root ul element now changed from id="Birch" to id=“FoldingText”
  • file extensions and format names now changed from BML to FTML

#10

Ver 17 of FTMD save/paste as FTML fixes an HTML entity encoding issue.