bbedit refresh

Edzard's Avatar


20 Apr, 2015 09:13 PM

Greetings is it possible to have the marked window of a open file in bbedit refresh without the need to save the file in bbedit?


  1. Support Staff 1 Posted by Brett on 20 Apr, 2015 10:00 PM

    Brett's Avatar

    No, Marked watches for changes in the filesystem and reads the file that exists on the disk, not the text in memory for an unsaved window. You could assign a keyboard shortcut to the Markup->Preview in... command, but if the current file isn't saved it will create a new temp window, which isn't ideal for this.

    However, if you had the skills, there is a "streaming preview" as well as a 'marked://preview?text=' URL handler that lets you pass text directly to a temporary window. Everything below is advanced, and I don't know your skill level, so if you're not a coder you'll have to accept the above as the answer.

    If you found a way to "stream" text to the url handler while editing, you could create a more "live" preview. I haven't experimented with this in BBEdit, but I mention it just in case you're familiar with building BBEdit plugins...

    The streaming preview can be opened from the Marked "Preview" menu item, or by using the marked://stream/ url. It watches a named clipboard for changes and updates instantly. This would be the ideal solution. On changes in the document, you'd collect the contents of the current view and post them:

    NSString *rawString = @"the text to be processed";
    // pasteboard *must* be named 'mkStreamingPreview'
    NSPasteboard* pb = [NSPasteboard pasteboardWithName:@"mkStreamingPreview"];
    [pb clearContents];
    [pb setString:rawString forType:(NSString*)kUTTypeUTF8PlainText];

    That's ideal, but requires Cocoa API access, and I don't know if there's an easy way to do that in BBEdit. I have this integrated in my local dev version of nvALT and it's beautiful, but really something that has to be incorporated by the app's dev, rather than plugin creators.

    The url handler is more accessible, but faulty in this case. Docs are at The current documentation is incomplete for this command, as elaborated below.

    The issue is that opening this url will bring Marked to the foreground. There's an 'x-success' parameter that will open a url scheme after update, but I'm not sure if BBEdit currently has one. It used to handle txmt: urls, but it seems to be breaking on those now.

    The required parameter for marked://preview is 'text', which creates a temporary window. Sending the same command again creates a new temp window, but you can create a reusable window by including 'window' and 'id' parameters. You can also optionally specify a 'base' parameter so it knows where to find included files and images. All values just need to be HTML escaped.

    This is all new, and probably not helpful, but feel free to report issues.

    Example command:

    open 'marked://preview/?text=[markdown content]&window=BBEdit%20Preview&id=com.bbedit.preview&base=[base dir for current file]'


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


? 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