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
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
ts
import { defaults } from 'protocol-launcher/marked'
const url = defaults({
syntaxHighlight: 1,
includeMathJax: 0,
})
const noRefreshUrl = defaults({
syntaxHighlight: 1,
refresh: 0,
})Run JavaScript
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
ts
import { help } from 'protocol-launcher/marked'
const pageUrl = help({
page: 'Document_Statistics',
})
const pathUrl = help({
path: 'Keyword_Highlighting:editingkeywords',
syntax: 'path',
})Open Document
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
ts
import { paste } from 'protocol-launcher/marked'
const url = paste()Preview Text
ts
import { preview } from 'protocol-launcher/marked'
const url = preview({
text: 'Some text to preview\n',
})Refresh Preview
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
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',
})