URL Handler

Marked’s URL handler provides additional scripting and workflow capabilities. You can include a url in the notes of another application, for example, that will open a file in Marked when clicked. You can perform several actions, as listed below.

Any command can provide an x-success query parameter. Set this to a url to be called after performing the command. For example: marked://open/?file=filename.md&x-success=ithoughts:.

open

Opens the specified document in Marked.

marked://open?file=/Users/username/Desktop/report.md
Parameters:

file(s) (required): The full POSIX path to the document to be opened, or comma-separated list of paths

Open also accepts a path whose components will be combined into a single url

marked://open/~/nvALT2.2

If the file path provided doesn’t exist or can’t be opened, Marked will still come to the forefront. Running without the file parameter or with a blank value will simply open Marked.

Marked will also open files if only the path of a file is called on the URL handler, e.g. marked:///Users/username/Desktop/report.md.

refresh

Refresh a document preview or all open previews.

Accepts: file query parameter containing comma-separated paths/filenames

marked://refresh

marked://refresh?file=/Users/username/Desktop/report.md

marked://refresh?file=report.md

Paths split by / will search multiple files, and partial filenames will complete the best match.

marked://refresh/filename1/filename2
Parameters:

file (optional): The path (or comma-separated paths) of files currently open in Marked.

Note: If no file parameter is included, Marked will refresh the frontmost document. The file parameter can be partial, Marked will refresh all open windows with a partial match in the filename (not the full path). Passing “all” will refresh all windows.

paste

Create a new document from the current contents of the clipboard.

marked://paste
Parameters:

none

Note: This creates a temporary document using the “Preview Clipboard” command. Any text in your clipboard is added to a new, blank document, which is then opened in Marked. If closed without saving, it’s discarded.

preview

Preview specified text in a new document.

marked://preview?text=Some%20text%20to%20%2A%2Apreview%2A%2A%0A
Parameters:

text (required): The text to insert into the preview. Percent-encoded text will be unencoded prior to viewing the document.

Note: This creates a temporary document using the “Preview Clipboard” command. The passed text is added to a new, blank document, which is then opened in Marked. If closed without saving, it’s discarded.

style

Set the preview style (CSS) for one or more documents

Parameters:

css (required): query string containing the name or path of a style. Styles must be present in Marked’s style menu as default or manually-added custom styles.

  • Accepts path parameters referencing names of files, or “all”

  • Paths split by / will search multiple files

  • Partial filenames will complete best match

    marked://style/filename1/filename2?css=...
    marked://style/all?css=...
    

file: query parameter containing comma-separated paths/filenames

marked://style?file=filename1,filename2&css=...

Will operate on frontmost window if a filename is not given (or “all” is not passed)

do

Run a JavaScript command in a document window.

Parameters:

js (required): query string containing a javascript command

  • Accepts path parameters referencing names of files, or “all”

  • Paths split by / will search multiple files

  • Partial filenames will complete best match

    marked://do/filename1/filename2?js=...
    marked://do/all?js=...
    

file: query parameter containing comma-separated paths/filenames

marked://do?file=filename1,filename2&js=...

Will operate on frontmost window if a filename is not given (or “all” is not passed)


Search | Support Site | Knowledgebase