Thank you, TJ! (And thank you for overlooking egregious wording errors and losses in my post. Ack!) - David W.
On Wednesday, May 29, 2013 4:39:59 PM UTC-4, TJ Luoma wrote: > > > On 29 May 2013, at 13:19, dweinberger wrote: > > > I've looked around for samples and instructions, but I haven't found > > what > > I'm looking. Which isn't to say that they're not there, and probably > > right > > under my nose. > > > > I want to the content of the front BBedit through pandoc with the > > appropriate parameters set, so that it turns markdown into html just > > the > > way I like it. (Preferably, I'd like to save the resulting html as a > > file > > with the same name as the file in the front window, but with a .html > > extension. But this is in parentheses because it's icing on the cake.) > > > > I think we're supposed to do this through a Text Factory, perhaps > > using the > > run Unix Filter, but I can't figure out how to do it. Are there > > samples > > that use command line apps in similar ways? > > I don't know if this is the "right" way to think about it, but I always > think of Unix Filters as "I want to do something and change the file > that I am working on" but I think of "Scripts" as "I want to take this > file and do something else to it. > > For example: if I want to change the current document so that its > content has been processed with 'sort -u | sed G' then I'd use a Unix > Filter, but if I wanted to take the current document and convert it to > Markdown, then I'd use a "Script". > > The BBEdit user manual has information on this around page 318. > > > > (I've installed markdown to html scripts that work fine. I'm looking > > for a > > little more control. Plus, pandoc will also convert markdown to rtf, > > which > > I occasionally need.) > > Here's a very simple example which uses multimarkdown to convert the > current file to HTML > > #!/bin/zsh -f > > INPUT_FILE="$BB_DOC_PATH" > > OUTPUT_FILE="$INPUT_FILE:r.html" > > multimarkdown --extensions --smart --process-html --to=html > --output="$OUTPUT_FILENAME" "$INPUT_FILE" > > exit > > save that as "MMD to HTML.sh" and put it in the "/Application > Support/BBEdit/Scripts/" folder and it will appear in your Scripts menu. > > There's a much more complicated version of this (it does a lot of error > checking, as well as letting you specify what app should open the file > that you create) available as "MMD to HTML.zsh" at > > https://github.com/tjluoma/bbedit > > but the above version is a (*ahem*) bare bones example of how you can do > it. Search the user manual for BB_DOC_PATH for more. > > TjL > > -- This is the BBEdit Talk public discussion group. If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
