hackstream / zettel

A notes organizer - based on Zettelkasten methodology.
GNU General Public License v3.0
156 stars 10 forks source link

Syntax Highlighting #14

Closed athul closed 4 years ago

athul commented 4 years ago

Adding Support for Syntax Highlighting would be much useful. I implemented one on my personal fork with chroma and it works perfectly. I also had an idea on customizing the colorschemes from the zettel.toml file, and found a rather crooked workaround with golang maps.

colorScheme := map[string]*chroma.Style{
        "Monokai":      styles.Monokai,
        "MonokaiLight": styles.MonokaiLight,
    }

This has to be finished with all the colorschemes of chroma. The current build works fine. Need some feedback for he above.

I'll send a PR soon

mr-karan commented 4 years ago

I think https://pygments.org/ is a good solution. We use it in many Hugo themes. The config structure is also simple:

# Enable syntax highlighting.
pygmentsstyle = "solarized-light"

More options can be found here which we can implement: https://pygments.org/docs/styles/

EDIT: I have a WIP solution with this, will be sending a PR.

athul commented 4 years ago

Chroma is Pygments in Go. So it has the same highlighting and all.

Hugo uses Chroma as its code highlighter; it is built in Go and is really, really fast – and for the most important parts compatible with Pygments we used before.

Taken from hugo website

I too have a WIP 😅

mr-karan commented 4 years ago

Ah, okay. Wasn't aware :)

EDIT: I just realised you are talking about your own personal fork of zettel. My bad :)

Okay feel free to send the PR!