├── Sublime
└── Marked 2.sublime-build
├── Services
├── Open Current File in Marked.workflow
│ └── Contents
│ │ ├── QuickLook
│ │ └── Thumbnail.png
│ │ ├── Info.plist
│ │ └── document.wflow
└── Preview Selection in Marked.workflow
│ └── Contents
│ ├── QuickLook
│ └── Thumbnail.png
│ ├── Info.plist
│ └── document.wflow
├── Emacs
└── dot.emacs.txt
├── BBEdit
└── Open in Marked.applescript
├── iAWriter
└── Open in Marked.applescript
├── TextMate
└── Marked 2.tmbundle
│ ├── info.plist
│ └── Commands
│ ├── Strip Header IDs.tmCommand
│ ├── Open in Marked 2.tmCommand
│ └── Preview Selection in Marked 2.tmCommand
├── Watchers
├── nvwatch.rb
└── everwatch.rb
├── install
├── AppleScript
└── OpenInMarked.applescript
└── README.md
/Sublime/Marked 2.sublime-build:
--------------------------------------------------------------------------------
1 | {
2 | "cmd": ["open","-a","/Applications/Marked 2.app","$file"],
3 | "selector": "text.html.markdown"
4 | }
--------------------------------------------------------------------------------
/Services/Open Current File in Marked.workflow/Contents/QuickLook/Thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttscoff/marked-bonus-pack/master/Services/Open Current File in Marked.workflow/Contents/QuickLook/Thumbnail.png
--------------------------------------------------------------------------------
/Services/Preview Selection in Marked.workflow/Contents/QuickLook/Thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttscoff/marked-bonus-pack/master/Services/Preview Selection in Marked.workflow/Contents/QuickLook/Thumbnail.png
--------------------------------------------------------------------------------
/Emacs/dot.emacs.txt:
--------------------------------------------------------------------------------
1 | (defun markdown-preview-file ()
2 | "use Marked 2 to preview the current file"
3 | (interactive)
4 | (shell-command
5 | (format "open -a 'Marked 2.app' %s"
6 | (shell-quote-argument (buffer-file-name))))
7 | )
8 | (global-set-key "\C-cm" 'markdown-preview-file)
9 |
--------------------------------------------------------------------------------
/BBEdit/Open in Marked.applescript:
--------------------------------------------------------------------------------
1 | -- Place in ~/Library/Application Support/BBEdit/Scripts
2 | -- Use from the Script menu bar item while editing a Markdown document (must be saved first)
3 | -- Assign a shortcut key in BBEedit Preferences->Menu Items
4 | tell application "BBEdit" to set mdFile to file of document of window 1
5 | tell application "Marked 2"
6 | activate
7 | open mdFile
8 | end tell
9 |
--------------------------------------------------------------------------------
/Services/Open Current File in Marked.workflow/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSServices
6 |
7 |
8 | NSMenuItem
9 |
10 | default
11 | Open Current File in Marked
12 |
13 | NSMessage
14 | runWorkflowAsService
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/iAWriter/Open in Marked.applescript:
--------------------------------------------------------------------------------
1 | -- Preview the currently active iA Writer document using Marked.
2 | tell application "iA Writer"
3 | activate
4 |
5 | -- Ask iA Writer for it's active document.
6 | set the_document to document 1
7 |
8 | -- Save the document or prompt if not previously saved.
9 | save the_document
10 |
11 | -- If the file is saved, open it using Marked.
12 | tell application "Marked"
13 | set the_file to the_document's file
14 | open the_file
15 | -- Bring Marked forward so it becomes visible.
16 | activate
17 | end tell
18 |
19 | end tell
--------------------------------------------------------------------------------
/TextMate/Marked 2.tmbundle/info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | contactEmailRot13
6 | wnerq@xbgsh.arg
7 | contactName
8 | Jared Crapo
9 | description
10 | Preview markdown in [Marked 2](http://marked2app.com).
11 | name
12 | Marked 2
13 | uuid
14 | 98FC9536-43B0-4A09-873E-DD7ED25C291B
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Services/Preview Selection in Marked.workflow/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSServices
6 |
7 |
8 | NSMenuItem
9 |
10 | default
11 | Preview Selection in Marked
12 |
13 | NSMessage
14 | runWorkflowAsService
15 | NSSendTypes
16 |
17 | public.utf8-plain-text
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/TextMate/Marked 2.tmbundle/Commands/Strip Header IDs.tmCommand:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | nop
7 | command
8 | #!/usr/bin/env ruby18 -wKU
9 | input = STDIN.read
10 | puts input.gsub(/(h\d) id=".*?"/,"\\1")
11 |
12 | input
13 | document
14 | inputFormat
15 | text
16 | name
17 | Strip Header IDs
18 | outputCaret
19 | heuristic
20 | outputFormat
21 | text
22 | outputLocation
23 | replaceInput
24 | scope
25 | text.html
26 | uuid
27 | E66EE61A-0D66-44B0-899E-DA4DD9D1E20F
28 | version
29 | 2
30 |
31 |
32 |
--------------------------------------------------------------------------------
/TextMate/Marked 2.tmbundle/Commands/Open in Marked 2.tmCommand:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | nop
7 | command
8 | #!/usr/bin/env bash
9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
10 |
11 | open -a "Marked 2.app" "$TM_FILEPATH"
12 | osascript -e 'tell application "Marked 2" to activate'
13 |
14 | input
15 | none
16 | inputFormat
17 | text
18 | keyEquivalent
19 | ^~m
20 | name
21 | Open in Marked 2
22 | outputCaret
23 | afterOutput
24 | outputFormat
25 | text
26 | outputLocation
27 | discard
28 | scope
29 | text.html.markdown, text.html.markdown.multimarkdown, text.html
30 | uuid
31 | 74F0D07D-C2F7-4CDC-B08B-25024657AAF4
32 | version
33 | 2
34 |
35 |
36 |
--------------------------------------------------------------------------------
/TextMate/Marked 2.tmbundle/Commands/Preview Selection in Marked 2.tmCommand:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | saveActiveFile
7 | command
8 | #!/usr/bin/env bash
9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
10 |
11 | TMPFILE=`mktemp -t marked2-preview`
12 | cat > $TMPFILE
13 | open -a "Marked 2.app" $TMPFILE
14 | osascript -e 'tell application "Marked 2" to activate'
15 | input
16 | selection
17 | inputFormat
18 | text
19 | keyEquivalent
20 | ^~m
21 | name
22 | Preview Selection in Marked 2
23 | outputCaret
24 | afterOutput
25 | outputFormat
26 | text
27 | outputLocation
28 | discard
29 | scope
30 | text.html.markdown, text.html.markdown.multimarkdown, text.html
31 | uuid
32 | F0BD6911-FCB2-4B6B-AE72-19DB9F3F86D6
33 | version
34 | 2
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Watchers/nvwatch.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # watch.rb by Brett Terpstra, 2011
3 | # Watch Notational Velocity notes folder for changes and
4 | # update a preview file for Marked with most recently-modified file contents
5 | # Requres that notes be stored as plain text and notes folder be customized below
6 |
7 | trap("SIGINT") { exit }
8 |
9 | watch_folder = "/Users/ttscoff/Dropbox/Notes/nvALT2.1"
10 | watch_types = ['txt','md']
11 | marked_note = File.expand_path("~/Marked Preview.md")
12 |
13 | while true do # repeat infinitely
14 | files = []
15 | watch_types.each {|type|
16 | files += Dir.glob( File.join( watch_folder, "**", "*.#{type}" ) )
17 | } # collect a list of files of specified type
18 | new_hash = files.collect {|f| [ f, File.stat(f).mtime.to_i ] } # create a hash of timestamps
19 | hash ||= new_hash
20 | diff_hash = new_hash - hash # check for changes
21 |
22 | unless diff_hash.empty? # if changes were found in the timestamps
23 | hash = new_hash
24 | puts "changed"
25 | note_file = File.new("#{diff_hash[0][0]}",'r') # read the latest changed file from the hash
26 | note = note_file.read
27 | note_file.close
28 | watch_note = File.new("#{marked_note}",'w') # write its contents to the preview file
29 | watch_note.puts note
30 | watch_note.close
31 | end
32 |
33 | sleep 1
34 | end
--------------------------------------------------------------------------------
/install:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env bash
2 |
3 | services() {
4 | cp -r Services/* $HOME/Library/Services
5 | }
6 |
7 | bbedit() {
8 | BBEDIT_DIR="$HOME/Library/Application Support/BBEdit/Scripts/"
9 | mkdir -p "$BBEDIT_DIR"
10 | cp "BBEdit/Open in Marked.applescript" "$BBEDIT_DIR"
11 | }
12 |
13 | st2() {
14 | ST2_DIR="$HOME/Library/Application Support/Sublime Text 2/Packages/User"
15 | mkdir -p "$ST2_DIR"
16 | cp "Sublime/Marked 2.sublime-build" "$ST2_DIR"
17 | }
18 |
19 | st3() {
20 | ST3_DIR="$HOME/Library/Application Support/Sublime Text 3/Packages/User"
21 | mkdir -p "$ST3_DIR"
22 | cp "Sublime/Marked 2.sublime-build" "$ST3_DIR"
23 | }
24 |
25 | iawriter() {
26 | IAWRITER_DIR="$HOME/Library/Scripts/Applications/iA Writer/"
27 | mkdir -p "$IAWRITER_DIR"
28 | cp "iAWriter/Open in Marked.applescript" "$IAWRITER_DIR"
29 | }
30 |
31 | # TODO:
32 | # Add vim support.
33 | # Add emacs support.
34 |
35 | if [[ -z $@ ]]
36 | then
37 | cat << EOF
38 | This scriptlet automates installing *some* elements of the Marked
39 | bonus pack. It currently supports the targets listed below, using the
40 | corresponding keywords:
41 |
42 | Target Keyword
43 | -------------- --------
44 | Services services
45 | BBEdit. bbedit
46 | Sublime Text 2 st2
47 | Sublime Text 3 st3
48 | iA Writer. iawriter
49 |
50 | Invoke it with one or more of the keywords as arguments, e.g.
51 |
52 | ./install services st3
53 | EOF
54 | else
55 | for i in $@
56 | do
57 | echo "Installing $i"
58 | $i
59 | done
60 | fi
61 |
--------------------------------------------------------------------------------
/Watchers/everwatch.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # everwatch.rb by Brett Terpstra, 2011
3 | # Watch Evernote for updates and put the current content of the editor into a preview file for Marked.app
4 | #
5 |
6 | trap("SIGINT") { exit }
7 |
8 | watch_folder = File.expand_path("~/Library/Application Support/Evernote/data")
9 | if not File.directory?(watch_folder)
10 | # evernote from the app store uses a different path
11 | # because of the sandbox rules
12 | app_folder = File.expand_path("~/Library/Application Support/com.evernote.Evernote/accounts/www.evernote.com")
13 | # inside app_folder, there is a folder with your evernote user id. If you
14 | # have multiple evernote user id's this will probably break, but most
15 | # people don't, so we should be good
16 | watch_folder = Dir.glob("#{app_folder}/*").first
17 | end
18 | marked_note = File.expand_path("~/Marked Preview.md")
19 | counter = 0
20 |
21 | while true do # repeat infinitely
22 |
23 | # read a list of files from the autosave folder
24 | files = Dir.glob( File.join( watch_folder, "*") )
25 | # build a hash of timestamps
26 |
27 | new_hash = files.collect {|f| [ f, File.stat(f).mtime.to_i ] }
28 | hash ||= new_hash
29 | # check for timestamp changes since the last loop
30 | diff_hash = new_hash - hash
31 |
32 | if diff_hash.empty? # if there's no change
33 | # if it's been less than 10 seconds, increment the counter
34 | # otherwise, set it to zero and wait for new changes
35 | counter = (counter < 10 && counter > 0) ? counter + 1 : 0
36 | else
37 | # store the new hash and start the 10 second change timer at 1
38 | hash = new_hash
39 | counter = 1
40 | end
41 |
42 | if counter > 0 # if the time is running
43 | # get the contents of the post and continued editor screens
44 | note = %x{ osascript <#{note}