tag:support.markedapp.com,2011-09-11:/discussions/questions/9047-how-do-i-enable-highlighting-in-marked-2Marked: Discussion 2017-11-23T02:45:26Ztag:support.markedapp.com,2011-09-11:Comment/440822442017-11-20T16:24:57Z2017-11-22T13:44:21ZHow do I enable ::highlighting:: in Marked 2?<div><p>In a couple of text editors I use (Bear, Ulysses) I can use ::this highlighting syntax::</p>
<p>In the above, the 'this highlighting syntax' will appear as if highlighted by a highlighting pen.</p>
<p>It's a feature I use a lot but I don't see Marked 2 converting ::text:: to highlighted.</p>
<p>Is there a way to enable this?</p>
<p>Thanks,</p>
<p>Pat</p></div>patrickgilmourtag:support.markedapp.com,2011-09-11:Comment/440822442017-11-20T17:32:08Z2017-11-20T17:32:08ZHow do I enable ::highlighting:: in Marked 2?<div><p>This isn't Markdown syntax in any flavor that I know of, I assume it's<br>
specific to Bear and Ulysses, both of which implement their own<br>
variation of Markdown. Generally in Markdown, you'd use the html<br>
<code><mark></code> tag to highlight text, but it would also be possible to use a custom preprocessor to do the replacement automatically.</p>
<p>-Brett</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/440822442017-11-21T13:41:18Z2017-11-22T13:44:21ZHow do I enable ::highlighting:: in Marked 2?<div><p>Brett - thanks for the answer!</p>
<p>I'm assuming I should take a look here. Hopefully, I can get my head around it:<br>
<a href="http://marked2app.com/help/Custom_Processor.html">http://marked2app.com/help/Custom_Processor.html</a></p>
<p>Will post back, if I do.</p>
<p>Pat</p></div>patrickgilmourtag:support.markedapp.com,2011-09-11:Comment/440822442017-11-21T20:49:30Z2017-11-21T20:49:30ZHow do I enable ::highlighting:: in Marked 2?<div><p>The preprocessor could be pretty simple. The code below can be saved to a file, made executable, and run as a preprocessor (see the docs for more detail):</p>
<pre>
<code>#!/bin/bash
cat | sed -E 's/::[[:alnum:]](.*)[[:alnum:]]::/<mark>\1<\/mark>/g'</code>
</pre></div>Bretttag:support.markedapp.com,2011-09-11:Comment/440822442017-11-22T13:47:16Z2017-11-22T13:47:17ZHow do I enable ::highlighting:: in Marked 2?<div><p>Thanks for sharing that!</p>
<p>I created the file as <code>marked-comment-highlight.sh</code> and used chmod +x on it.</p>
<p>I get the error:</p>
<blockquote>
<p>ERROR: Custom processor is not executable Please ensure that your user has permission to execute marked-comment-highlight.sh</p>
</blockquote>
<p>I assume this means I need the non-MAS version of Marked 2, so I've requested the cross-grade as per the instructions in the error dialog. Is that the right step?</p></div>patrickgilmourtag:support.markedapp.com,2011-09-11:Comment/440822442017-11-22T17:00:05Z2017-11-22T17:00:05ZHow do I enable ::highlighting:: in Marked 2?<div><p>I would first try this:</p>
<p>Set the preprocessor to /bin/bash</p>
<p>Then set the argument to the path to the script</p>
<p>-Brett</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/440822442017-11-23T00:05:13Z2017-11-23T00:05:14ZHow do I enable ::highlighting:: in Marked 2?<div><p>Very sensible advice ;-)</p>
<p>I did as you suggest and things worked better, though I still wasn't at liberty to choose where I wanted my script to live. Moving to the non-MAS version fixed that--thanks for sending over the new license!</p>
<p>One thing, the regex in the script matches: <code>::[[:alnum:]](.*)[[:alnum:]]::</code> then wraps a mark tag round the wildcard group. This means the first character fo the string was being removed. It also meant that if the marked text started with anything other than alphanumeric text, it didn't mark.</p>
<p>I changed the search string to the very greedy <code>::(.*)::</code> and for everything I've tried so far, it seems to work. Maybe pitfalls await, but so far, so good.</p>
<p>Thanks for you help!</p></div>patrickgilmourtag:support.markedapp.com,2011-09-11:Comment/440822442017-11-23T02:45:25Z2017-11-23T02:45:25ZHow do I enable ::highlighting:: in Marked 2?<div><p>Good call, didn't test that :). You could also just move the parens around the alnum groups.</p>
<p>Thanks,<br>
Brett</p></div>Brett