Hi,

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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 "[email protected]" 
rather than posting to the group.
-~----------~----~----~----~------~----~------~--~---

Reply via email to