Markdown allows for human readable formating. h1 headers are generated with '=' signs, so
this line ====== translates to <h1>this line</h1>
For aesthetic reasons I like to have the '=' underline the same count of characters as the line above it (monospaced font presupposed). Being a klutz at applescript I managed to splutter together the following script:
--- start --- tell application "BBEdit" tell window 1 get characterOffset of selection set theSel to (startLine of selection) get theSel set theCount to count characters of (line theSel) set theLine to return repeat theCount times set theLine to theLine & "=" # use "-" for h2 headers end repeat select insertion point after line theSel set selection to theLine select insertion point after selection end tell end tell --- end ---
The script works fine but I have the dim feeling that this could be done more elegantly and much shorter. Perhaps some applescript ninja out there has some hints on this? I'm willing to learn.
(and if not: as this works maybe some other Markdown users might find this helpful)
Regards, Roland
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a specific feature request or would like to report a suspected (or confirmed) problem with the software, please email to "support@barebones.com" rather than posting to the group. -~----------~----~----~----~------~----~------~--~-
Search
Lasso Programming
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!