Skip to content

Marked

Marked is a macOS Markdown preview app. Protocol Launcher allows you to generate deep links for Marked.

Usage

There are two ways to use this library:

  • On-Demand import from subpaths enables tree-shaking and keeps bundles small.
  • Full Import from the root package is convenient but includes all app modules.

Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.

Select Installation Method

On-Demand
Recommended. Optimized for production.
Full Import
Convenient. Good for quick scripts.

URL Methods

The helpers below mirror the commands and parameters documented by Marked.

Add Custom Style

On-Demand
ts
import { addStyle } from 'protocol-launcher/marked'

const cssUrl = addStyle({
  name: 'My new style',
  css: 'body { color: red; }',
})

const fileUrl = addStyle({
  file: '/Users/myuser/Custom Styles/Unicorn.css',
})

Set Defaults

On-Demand
ts
import { defaults } from 'protocol-launcher/marked'

const url = defaults({
  syntaxHighlight: 1,
  includeMathJax: 0,
})

const noRefreshUrl = defaults({
  syntaxHighlight: 1,
  refresh: 0,
})

Run JavaScript

On-Demand
ts
import { runJavaScript } from 'protocol-launcher/marked'

const url = runJavaScript({
  js: 'Marked.file.refresh()',
})

const pathUrl = runJavaScript({
  path: 'filename1/filename2',
  syntax: 'path',
  js: 'Marked.file.refresh()',
})

Open Help

On-Demand
ts
import { help } from 'protocol-launcher/marked'

const pageUrl = help({
  page: 'Document_Statistics',
})

const pathUrl = help({
  path: 'Keyword_Highlighting:editingkeywords',
  syntax: 'path',
})

Open Document

On-Demand
ts
import { open } from 'protocol-launcher/marked'

const fileUrl = open({
  file: '/Users/username/Desktop/report.md',
})

const pathUrl = open({
  path: '~/nvALT2.2',
  syntax: 'path',
})

const directPathUrl = open({
  path: '/Users/username/Desktop/report.md',
  syntax: 'direct',
})

const raiseUrl = open({
  file: 'filename.md',
  raise: true,
})

Paste Clipboard

On-Demand
ts
import { paste } from 'protocol-launcher/marked'

const url = paste()

Preview Text

On-Demand
ts
import { preview } from 'protocol-launcher/marked'

const url = preview({
  text: 'Some text to preview\n',
})

Refresh Preview

On-Demand
ts
import { refresh } from 'protocol-launcher/marked'

const allUrl = refresh()

const fileUrl = refresh({
  file: '/Users/username/Desktop/report.md',
})

const explicitAllUrl = refresh({
  file: 'all',
})

const pathUrl = refresh({
  path: 'filename1/filename2',
  syntax: 'path',
})

Set Preview Style

On-Demand
ts
import { style } from 'protocol-launcher/marked'

const url = style({
  css: 'Github',
})

const fileUrl = style({
  file: 'filename1,filename2',
  css: 'Github',
})

const pathUrl = style({
  path: 'all',
  syntax: 'path',
  css: 'Github',
})

Official Documentation