Zettelkasten Forum


How to: Code Highlight/ Code Blocks

edited August 2021 in Resolved Issues

Hey there,

I use '>' or '>>' to highlight my code, but I suppose that it is not the intended use of these marks.

I would like the app to support either dedicated code blocks, like in Ulysses, or some other kind of a code highlight to delineate the code from the regular text.

P.S. I've lurked the forum and haven't found a similar topic. I hope it is not a duplicate.

Post edited by ctietze on

Comments

  • In the Markdown convention, > denoted blockquotes (like in email)

    For code blocks, you'd typically indent each line with 4+ spaces or 1+ tabs.

    Or you enclose the code in 3 backticks

    text here
    
    ```
    code 
    here
    ```
    
    ta-da!
    

    With that, I'm not sure what your request would now boil down to -- would you like an option to deactivate Markdown and write your plain text notes without any highlighting?

    Author at Zettelkasten.de • https://christiantietze.de/

  • Dear ctietze,

    Is it possible to change a colour of a text inside the backticks to make it more distinct? Like blue, for example.

    I use '>' because it changes the colour, which is helpful when code alternates with regular text.

  • Is this what you're looking for?
    Setting the code block's color is controlled by the theme. See Preferences.

    Solarized Dark

    Will's Custom


    The choices are in the Appearance tab in Preferences.

    Search the forums for additional themes if you don't like the defaults or create your own.

    Will Simpson
    I must keep doing my best even though I'm a failure. My peak cognition is behind me. One day soon I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
    kestrelcreek.com

  • Dear Will,

    Sorry for the long reply, but how can one create a custom theme? I haven't found such an option in the preferences and a howto on the forum.

  • Sorry that there's no prominent link in the app, that's a good point!

    You can see a guide here: https://github.com/Zettelkasten-Method/The-Archive-Themes

    Author at Zettelkasten.de • https://christiantietze.de/

  • Thank you for the link. By any chance, don't you plan to include a theme manager into the app?

  • @Svyat Kind of: I have made mockups for that in the past, but I don't want to pull away "engineering time" for that at the moment. Making customizations more accessible is an important task, though.

    Author at Zettelkasten.de • https://christiantietze.de/

  • I suspect @Svyat wants programming language specific syntax highlighting. Typically you specify the language name after the first 3 backticks.

  • @bvs said:
    I suspect @Svyat wants programming language specific syntax highlighting. Typically you specify the language name after the first 3 backticks.

    Not at all: Archive is not an IDE, I just want to distinguish my code snippets from the regular text.

Sign In or Register to comment.