-
-
Save rwilcox/2288375 to your computer and use it in GitHub Desktop.
Underline Titles (Markdown, reStructuredText) in BBEdit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Thanks to hristopher Stone | |
tell application "BBEdit" | |
set textDocument1 to a reference to text of text document 1 | |
tell textDocument1 | |
tell line (startLine of selection) | |
if startLine > 1 then | |
set lineContent to contents | |
if (length of lineContent = 1) and (lineContent is not " ") then | |
set prevLineContent to contents of textDocument1's line ((startLine) - 1) | |
tell application "BBEdit" to replace "." using lineContent searchingString prevLineContent options {search mode:grep} | |
set its contents to result | |
select insertion point after it | |
end if | |
end if | |
end tell | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment