Displaying code syntax highlighting by default

steven.thompson.ca's Avatar

steven.thompson.ca

25 Jan, 2017 05:11 PM

Hi, is there some way to make .md documents show proper code syntax highlighting? I'm using marked2 and when I do a quicklook on a file with code

```swift
func somecode() {
 print("nothing")
}
```

It just gives me a vanilla block with no highlighting. How do I get it to display a proper preview like I would see in marked2? Thanx.

  1. Support Staff 1 Posted by Brett on 25 Jan, 2017 07:00 PM

    Brett's Avatar

    Do you have syntax highlighting turned on under Style preferences?

    -Brett

  2. 2 Posted by steven.thompson... on 25 Jan, 2017 07:30 PM

    steven.thompson.ca's Avatar

    Yes I do. To be clear, I'm looking at the file in Finder not Marked2. So technically it isn't a Marked2 question. Maybe you can point me to a post or something that answers this question. I want to see markdown files similar to the way I'm seeing them in marked2 but using quicklook. Thanx.

  3. Support Staff 3 Posted by Brett on 25 Jan, 2017 07:51 PM

    Brett's Avatar

    I don't know of a Quick Look generator offhand that previews Markdown
    with code highlighting, but you could hack one together using pygments
    or something. Here's my fork of Fletcher Penney's:

    https://github.com/ttscoff/MMD-QuickLook

    And here's one specifically for syntax highlighting that you might be
    able to incorporate:

    https://github.com/n8gray/QLColorCode

    -Brett

Reply to this discussion

Internal reply

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

Attaching KB article:

»

Already uploaded files

  • Screen_Shot_2017-01-25_at_12.09.16_PM.png 82.2 KB

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
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac