![bbedit markdown bbedit markdown](https://tidbits.com/uploads/2014/10/BBEdit-11-coloring.png)
#Bbedit markdown code#
This works okay, but there have always been things missing, like a way to easily add attributes to elements like my code blocks. This is as much the fault of my weird idiosyncratic bespoke-ancient setup as of WordPress itself, but it’s still super annoying and so I avoid it entirely.)Īnyway, the point here is that I write Markdown in BBEdit, and export it from there. (And I don’t use the block editor because whenever I use it to edit an old post, the markup in those posts get mangled so much that it makes me want to hurl. I do it that way because switching WordPress over to auto-parsing Markdown in posts causes problems with rendering the markup of some posts I wrote 15-20 years ago, and finding and fixing every instance is a lengthy project for which I do not have the time right now. let's make the Preview window frontmost if it existsĭisplay dialog "Please open the Preview window in BBEdit (Control-Command-P), or from the menu bar, choose 'Markup > Preview in BBEdit'.Thanks to the long and winding history of my blog, I write posts in Markdown in BBEdit, export them to HTML, and paste the resulting HTML into WordPress. My showPreview() # call everything above!
![bbedit markdown bbedit markdown](https://tidbits.com/uploads/2017/07/Mac-Markdown-ratings.jpg)
Set contents of front document to m & my newLine & my newLine & my breakLine & my newLine & my previewDivider & my newLine & my breakLine & mStr at last, let's load up our formatted text! Set mStr to my colourMentions:mStr startsWith:mentionStart one last bit of processing is to style the keywords Set mStr to NSString's spanOpen, mStr, spanClose) Set mStr to mStr's stringByReplacingOccurrencesOfString:(my newLine) withString:"" Set mStr to mStr's stringByReplacingOccurrencesOfString:"" withString:"" now that we have the correct HTML tags, we can add styling to suit here Set mStr to (my replaceFormatString:(aTag's slack) withTag:(aTag's html) inStr:mStr) most of the heavy lifting is done here: Set mStr to (mStr's substringToIndex:(loc)) Set previewRange to (mStr's rangeOfString:(my previewDivider)) If (mStr's containsString:(aTag's slack)) then does the text contain the current tag word in the repeat loop? Let's remove unwanted detritus created by previous iterations through the loop Set mStr to mStr's stringByReplacingOccurrencesOfString:">" withString:">" Set mStr to mStr's stringByReplacingOccurrencesOfString:">" withString:"+++" Set mStr to (NSString's stringWithString:m) reassign and replace the quote tags so that we can process them properly later if this isn't the first run, remove any previous preview If m's text item 1 is then set mentionStart to true # set debugArray to NSArray's arrayWithArray: # '+++' is a dummy here, not a real Slack formatting option Property NSArray : a reference to current application's NSArray Property NSString : a reference to current application's NSString Property NSCharacterSet : a reference to current application's NSCharacterSet Property NSMutableArray : a reference to current application's NSMutableArray Use AppleScript version "2.4" - Yosemite (10.10) or later
#Bbedit markdown how to#
'BBEdit: how to preview Slack messages' on at
#Bbedit markdown full#
This script does NOT require Slack.app, but does assume you know how to format Slack messages.įor a full description of how to use it, see the blog post and video
#Bbedit markdown trial#
Useful if you're in a Slack group with editing timeouts but you have to post lengthy or heavily formatted messages.ĭEPENDENCIES: BBEdit either while still in trial mode or with a license, as you need the Markdown features. 'Markdown' menu, it'll produce a simulation of what your message would look like in Slack. In a BBEDit document and then, through the 'Preview in BBEdit' menu item in BBEdit's If you use Slack, this script will allow you to write Slack-style formatting