marked-conductor 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +18 -3
- data/html/Array.html +1 -1
- data/html/Conductor/Command.html +1 -1
- data/html/Conductor/Condition.html +1 -1
- data/html/Conductor/Config.html +1 -1
- data/html/Conductor/Env.html +1 -1
- data/html/Conductor/Script.html +1 -1
- data/html/Conductor.html +2 -2
- data/html/FalseClass.html +1 -1
- data/html/Filter.html +10 -3
- data/html/Hash.html +1 -1
- data/html/Object.html +1 -1
- data/html/README_rdoc.html +1 -1
- data/html/String.html +121 -20
- data/html/TrueClass.html +1 -1
- data/html/YuiCompressor/Yui.html +447 -0
- data/html/YuiCompressor.html +93 -0
- data/html/created.rid +5 -4
- data/html/index.html +5 -1
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search_index.js +1 -1
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +57 -16
- data/lib/conductor/filter.rb +48 -0
- data/lib/conductor/version.rb +1 -1
- data/lib/conductor/yui-compressor.rb +230 -0
- data/lib/conductor.rb +1 -0
- data/src/_README.md +18 -3
- metadata +5 -2
data/src/_README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
# Marked Conductor
|
5
5
|
|
6
|
-
A "train conductor" for [Marked 2](https://marked2app.com). Conductor can be set up as a Custom Preprocessor or Custom Processor for Marked, and can run different commands and scripts based on conditions in a YAML configuration file, allowing you to have multiple processors that run based on predicates.
|
6
|
+
A "train conductor" for [Marked 2](https://marked2app.com) (Mac only). Conductor can be set up as a Custom Preprocessor or Custom Processor for Marked, and can run different commands and scripts based on conditions in a YAML configuration file, allowing you to have multiple processors that run based on predicates.
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
@@ -124,12 +124,16 @@ Conditions can be combined with AND or OR (must be uppercase) and simple parenth
|
|
124
124
|
|
125
125
|
The action can be `script`, `command`, or `filter`.
|
126
126
|
|
127
|
+
#### Scripts
|
128
|
+
|
127
129
|
**Scripts** are located in `~/.config/conductor/scripts/` and should be executable files that take input on STDIN (unless `$file` is specified in the `script` definition). If a script is defined starting with `~` or `/`, that will be interpreted as a full path to an alternate location.
|
128
130
|
|
129
131
|
> Example:
|
130
132
|
>
|
131
133
|
> script: github_pre
|
132
134
|
|
135
|
+
#### Commands
|
136
|
+
|
133
137
|
**Commands** are interpreted as shell commands. If a command exists in the `$PATH`, a full path will automatically be determined, so a command can be as simple as just `pandoc`. Add any arguments needed after the command.
|
134
138
|
|
135
139
|
> Example:
|
@@ -139,7 +143,10 @@ The action can be `script`, `command`, or `filter`.
|
|
139
143
|
|
140
144
|
> Using `$file` as an argument to a script or command will bypass processing of STDIN input, and instead use the value of $MARKED_PATH to read the contents of the specified file.
|
141
145
|
|
146
|
+
#### Filters
|
147
|
+
|
142
148
|
**Filters** are simple actions that can be run on the content without having to write a separate script for it. Available filters are:
|
149
|
+
|
143
150
|
| filter | description |
|
144
151
|
| :---- | :---------- |
|
145
152
|
| `setMeta(key, value)` | adds or updates a meta key, aware of YAML and MMD |
|
@@ -154,10 +161,18 @@ The action can be `script`, `command`, or `filter`.
|
|
154
161
|
| `prepend/appendFile(path)` | insert a file as Markdown at beginning or end of content |
|
155
162
|
| `prepend/appendRaw(path)` | insert a file as raw HTML at beginning or end of content |
|
156
163
|
| `prepend/appendCode(path)` | insert a file as a code block at beginning or end of content |
|
164
|
+
| `insertCSS(path)` | insert custom CSS into document |
|
165
|
+
| `autoLink()` | Turn bare URLs into \<self-linked\> urls |
|
166
|
+
|
167
|
+
For `replace` and `replaceAll`: If *search* is surrounded with forward slashes followed by optional flags (*i* for case-insensitive, *m* to make dot match newlines), e.g. `/contribut(ing)?/i`, it will be interpreted as a regular expression. The *replace* value can include numeric capture groups, e.g. `Follow$2`.
|
157
168
|
|
158
169
|
For `insertScript`, if path is just a filename it will look for a match in `~/.config/conductor/javascript` or `~/.config/conductor/scripts` and turn that into an absolute path if the file is found.
|
159
170
|
|
160
|
-
For `
|
171
|
+
For `insertCSS`, if path is just a filename (with or without .css extension), the file will be searched for in `~/.config/conductor/css` or `~/.config/conductor/files` and injected. CSS will be compressed using the YUI algorithm and inserted at the top of the document, but after any existing metadata.
|
172
|
+
|
173
|
+
For all of the prepend/append file filters, you can store files in `~/.config/conductor/files` and reference them with just a filename. Otherwise a full path will be assumed.
|
174
|
+
|
175
|
+
For `autoLink`, any URL that's not contained in parenthesis or following a `[]: url` pattern will be autolinked (surrounded by angle brackets). URLs must contain `//` to be recognized, but any protocol will work, e.g. `x-marked://refresh`.
|
161
176
|
|
162
177
|
> Example:
|
163
178
|
>
|
@@ -180,7 +195,7 @@ A script run by Conductor already knows it has the right type of file with the e
|
|
180
195
|
- Config file must be valid YAML. Any value containing colons, brackets, or other special characters should be quoted, e.g. (`condition: "text contains my:text"`)
|
181
196
|
- You can see what condition matched in Marked by opening **Help->Show Custom Processor Log** and checking the STDERR output.
|
182
197
|
- To run [a custom processor for Bear](https://brettterpstra.com/2023/10/08/marked-and-bear/), use the condition `"text contains <!-- source: bear.app -->"`. You might consider running a commonmark CLI with Bear to support more of its syntax.
|
183
|
-
- To run a custom processor for Obsidian, use the condition `tree contains .obsidian`
|
198
|
+
- To run a [custom processor for Obsidian](https://brettterpstra.com/2024/05/16/marked-2-and-obsidian/), use the condition `tree contains .obsidian`
|
184
199
|
|
185
200
|
## Testing
|
186
201
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marked-conductor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -218,6 +218,8 @@ files:
|
|
218
218
|
- html/README_rdoc.html
|
219
219
|
- html/String.html
|
220
220
|
- html/TrueClass.html
|
221
|
+
- html/YuiCompressor.html
|
222
|
+
- html/YuiCompressor/Yui.html
|
221
223
|
- html/created.rid
|
222
224
|
- html/css/fonts.css
|
223
225
|
- html/css/rdoc.css
|
@@ -275,6 +277,7 @@ files:
|
|
275
277
|
- lib/conductor/script.rb
|
276
278
|
- lib/conductor/string.rb
|
277
279
|
- lib/conductor/version.rb
|
280
|
+
- lib/conductor/yui-compressor.rb
|
278
281
|
- marked-conductor.gemspec
|
279
282
|
- src/_README.md
|
280
283
|
- test.md
|