Opening/previewing a file from BBEdit

Peter Anderson's Avatar

Peter Anderson

26 May, 2018 02:31 PM

// Please enter a detailed description of the issue // Description of the issue: First off, the latest release of Marked has solved a long standing problem with maintaining window sizes between usage of the app; thank you.
I use BBEdit as my main writing tool. BBEdit has a “Markup” menu item which contains a “Preview in Marked…” option. When this option is chosed Marked 2 cannot open the *.md file being edited. You can open the file after selecting the BBEdit window title bar and navigating to the particular file or by just going to Finder and opening the particular file. This is not a critical problem, just an ease of use one.

// Please enter a list of steps required to reproduce the issue // Steps to reproduce:

  1. See above.

// If applicable please attach a sample document that causes the issue for you.

// Configuration (do not edit) Marked 2 948 (Mac App Store)

macOS Version: 10.13.4

additionalMathJaxConfig:
allowPageBreakInCode: TRUE
bookTxtIsLeanpub: TRUE
summaryMdIsGitBook: TRUE
codeIsPoetry: TRUE
codeCanWrap: TRUE
collapsibleHeadlines: TRUE
convertGithubCheckboxes: TRUE
convertYAMLToMMD: TRUE
defaultMathJaxConfig: TeX-AMS-MML_HTMLorMML
defaultPreviewStyle: swiss
defaultProcessor: MultiMarkdown
enableMiniMap: TRUE
excludeBlockQuotesFromCounts: TRUE
excludeFootnotesFromCounts: TRUE
excludeVerbatimFromCounts: TRUE
excludeCaptionsFromCounts: TRUE
folderPreviewExtensionsArray: md, markdown, txt, mdown, html, opml
githubNewlines: TRUE
h1IsPageBreak: TRUE
h2IsPageBreak: TRUE
hrIsPageBreak: TRUE
includeMathJax: TRUE
limitTextWidth: TRUE
minimalJavaScript: TRUE
outlineModeExtensions:
permissionGranted: TRUE
printHeaderBottomLeft:
printHeaderBottomRight:
printHeaderFirstPage: TRUE
printFooterFirstPage: TRUE
printHeaderTopLeft:
printHeaderTopRight:
processHTMLFiles: TRUE
removeMetadataForPreview: TRUE
removeYAMLHeaders: TRUE
scrollToEdit: TRUE
shouldDetectCritic: TRUE
shouldHighlightMarkupErrors: TRUE
shouldLoadCritic: TRUE
syntaxHighlight: TRUE

  1. Support Staff 1 Posted by Brett on 26 May, 2018 08:07 PM

    Brett's Avatar

    BBEdit's "Markup->Preview in..." renders a temporary HTML file from the
    Markdown and opens that. It's not actually opening the file in Marked.
    Marked won't do anything other than display it because it doesn't
    attempt to override HTML styles, and when the temporary file is cleaned
    up by BBEdit, then Marked is left hanging with no file at all.

    To preview the file you're currently editing and be able to update on
    save (and take advantage of Marked's feature set), the best bet is to
    just drag the proxy icon from the BBEdit title bar to Marked's icon.

    -Brett

  2. Support Staff 2 Posted by Brett on 26 May, 2018 08:22 PM

    Brett's Avatar

    Just whipped up a little script:

    tell application "BBEdit" to set mdFile to file of document of window 1
    tell application "Marked 2"
        activate
        open mdFile
    end tell
    

    Save that as "~/Library/Application Support/BBEdit/Scripts/
    Open in Marked.scpt" using Script Editor and then you can assign a shortcut key in BBEdit Preferences->Menus to trigger it. It will simply open whatever file BBEdit is currently editing in Marked.

  3. 3 Posted by John Holland on 07 May, 2021 12:32 AM

    John Holland's Avatar

    Ran into the same issue with BBEdit two years on. Your little script @Brett works like a charm. As @Peter said, not such a major problem, just a little annoyance. I suppose one could use the BBEdit previewer, but Marked 2 just has so many more capabilities. Thanks for the script.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac