Ranea.org

Watts Martin’s web space

BBEdit Markdown Extension Package

Download (v1.03, 2011-08-21)

This adds new commands for working with Markdown documents to BBEdit—a few formatting convenience commands, as well as multiple transformations.

This package expects to be in ~/Library/Application Support/BBEdit/Packages/ and has not been tested with Dropbox support.

Helper Commands

  • Make Bullet List

    This simply adds “*” characters to the start of every selected line. It will remove bullets that are already present first. Note that this function is a little dim and can’t distinguish multi-paragraph bullets (like this one), nor will it handle nested bullet lists.

  • Make Numbered List

    Similar to the one above, with the same caveats. This will renumber a list consecutively.

  • Safari Tabs to Ref List

    Adapted from Brett Terpstra’s “Blogsmith” bundle for TextMate, this will create a reference-style list of all open tabs in the frontmost Safari window. This version is different from Brett’s in two regards: one, it doesn’t present a dialog box asking you to select which tabs you want—it just grabs all of them. Two, it doesn’t try to assign reference names, but instead lets you tab through the list to enter your own references. (This reflects my own usage, since I didn’t like Brett’s naming convention very much.)

Transformation Commands

  • Markdown to HTML

    Translates Markdown (either the selection or the whole document) to HTML, using the packaged copies of Markdown and SmartyPants.

  • HTML to Markdown

    Translates HTML (either the selection or the whole document) to Markdown, using the packaged copy of html2text.

  • Markdown to BBCode

    Does very limited translation of Markdown codes into BBCode. This operates on the whole document.

Paste as Markdown

This takes “rich text” on the clipboard and pastes it into a BBEdit document as Markdown. (The nerdy details: it converts from RTF to HTML and then from HTML to Markdown, then runs a bit of cleanup on the output.)

MultiMarkdown Support

Two convenience scripts are also included for MultiMarkdown support. They require MultiMarkdown 3 to be installed separately and available at /usr/local/bin/multimarkdown, which is where the installer package will put it by default. They do what you’d expect them to do from their names:

  • MultiMarkdown to HTML
  • MultiMarkdown to TeX

The MultiMarkdown commands create an entirely new untitled document with the language set appropriately, rather than replacing the selection.

Text Filters

All of the scripts used by this extension package are available directly as Text Filters, with the Unix-scripty names of html2text, markdown, mmd, mmd2tex and smartypants.

License

This package includes John Gruber’s Markdown and SmartyPants and Aaron Swartz’s html2text scripts. Those scripts are copyright to their respective authors.

The small bits of script I’ve done are Copyright (c) 2011 Watts Martin. Redistributions in any form must retain the above copyright notice, the attribution for included packages (with links), and the following disclaimer.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

(Whew.)

Changelog

  • 1.03, 2011-08-21: Display error dialog when MultiMarkdown isn’t found by MMD scripts.
  • 1.02, 2011-08-20: Make package relocatable rather than using hardcoded paths.
  • 1.01, 2011-08-14: Improve MultiMarkdown AppleScripts and add TeX script; add README.
  • 1.00, 2011-08-11: Initial release.