Syntax highlighting?

44 views
Skip to first unread message

MJW

unread,
Sep 25, 2019, 6:13:12 AM9/25/19
to Mergely

Hey folks,

Just wondering if there's an [easy] way to enable language-based syntax highlighting in Mergely?  As Mergely is based on CodeMirror, I was guessing that setting the CM "mode" option appropriately, but that doesn't seem to do the trick.

Alternatively, has anyone used highlight.js in conjunction with Mergely?

Cheers,
Michael.

Jamie Peabody

unread,
Sep 26, 2019, 3:05:48 AM9/26/19
to MJW, Mergely
Hi Michael,

You also need to load the appropriate mode from codemirror.  It was asked recently, and I gave an SQL example here:

Jamie 

--
You received this message because you are subscribed to the Google Groups "Mergely" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mergely+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mergely/89ea6b0b-a85f-4623-bfea-e18d2779bb29%40googlegroups.com.

MJW

unread,
Sep 26, 2019, 11:57:30 AM9/26/19
to Mergely
Excellent, thank you Jamie, that works a charm!

Now to figure out why the editor isn't resizing when inside a div with "resize: vertical" set...


On Thursday, 26 September 2019 08:05:48 UTC+1, Jamie Peabody wrote:
Hi Michael,

You also need to load the appropriate mode from codemirror.  It was asked recently, and I gave an SQL example here:

Jamie 

On Wed, 25 Sep 2019 at 11:13, MJW <m...@lazyknights.co.uk> wrote:

Hey folks,

Just wondering if there's an [easy] way to enable language-based syntax highlighting in Mergely?  As Mergely is based on CodeMirror, I was guessing that setting the CM "mode" option appropriately, but that doesn't seem to do the trick.

Alternatively, has anyone used highlight.js in conjunction with Mergely?

Cheers,
Michael.

--
You received this message because you are subscribed to the Google Groups "Mergely" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mer...@googlegroups.com.

MJW

unread,
Sep 26, 2019, 1:32:24 PM9/26/19
to Mergely
Fixed that with ResizeObserver:

new ResizeObserver( function() {
$('#mergely').resize();
}).observe( document.getElementById( 'mergely-resizer') );

"mergely-resizer" is a div with "resize: vertical" styled onto it...
Reply all
Reply to author
Forward
0 new messages