# How do I enable ::highlighting:: in Marked 2?

#### patrickgilmour

20 Nov, 2017 04:24 PM

In a couple of text editors I use (Bear, Ulysses) I can use ::this highlighting syntax::

In the above, the 'this highlighting syntax' will appear as if highlighted by a highlighting pen.

It's a feature I use a lot but I don't see Marked 2 converting ::text:: to highlighted.

Is there a way to enable this?

Thanks,

Pat

1. Support Staff Posted by Brett on 20 Nov, 2017 05:32 PM

This isn't Markdown syntax in any flavor that I know of, I assume it's
specific to Bear and Ulysses, both of which implement their own
variation of Markdown. Generally in Markdown, you'd use the html
<mark> tag to highlight text, but it would also be possible to use a
custom preprocessor to do the replacement automatically.

-Brett

2. Posted by patrickgilmour on 21 Nov, 2017 01:41 PM

Brett - thanks for the answer!

I'm assuming I should take a look here. Hopefully, I can get my head around it:
http://marked2app.com/help/Custom_Processor.html

Will post back, if I do.

Pat

3. Support Staff Posted by Brett on 21 Nov, 2017 08:49 PM

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):

#!/bin/bash
cat | sed -E 's/::[[:alnum:]](.*)[[:alnum:]]::/<mark>\1<\/mark>/g'

4. Posted by patrickgilmour on 22 Nov, 2017 01:47 PM

Thanks for sharing that!

I created the file as marked-comment-highlight.sh and used chmod +x on it.

I get the error:

ERROR: Custom processor is not executable Please ensure that your user has permission to execute marked-comment-highlight.sh

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?

5. Support Staff Posted by Brett on 22 Nov, 2017 05:00 PM

I would first try this:

Set the preprocessor to /bin/bash

Then set the argument to the path to the script

-Brett

6. Posted by patrickgilmour on 23 Nov, 2017 12:05 AM

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!

One thing, the regex in the script matches: ::[[:alnum:]](.*)[[:alnum:]]:: 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.

I changed the search string to the very greedy ::(.*):: and for everything I've tried so far, it seems to work. Maybe pitfalls await, but so far, so good.

Thanks for you help!

7. Support Staff Posted by Brett on 23 Nov, 2017 02:45 AM

Good call, didn't test that :). You could also just move the parens around the alnum groups.

Thanks,
Brett

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

### »

#### Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

# Keyboard shortcuts

### Generic

? Show this help Blurs the current field

### Comment Form

r Focus the comment reply box Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

## Recent Discussions

 21 Feb, 2020 11:32 PM Option to use MathJax 3? 20 Feb, 2020 03:12 PM Regular crashes 13 Feb, 2020 09:22 PM Markdown Formatting 11 Feb, 2020 11:53 AM Custom themes not working 10 Feb, 2020 06:48 PM KaTex Preview Update

## Recent Articles

 Using JavaScript in Marked Custom CSS: Writing custom CSS for Marked License code has already been utilized Highlight sentences longer than a certain number of words How do I retrieve a lost license (direct version)