backdrop-ops / forum.backdropcms.org

The Forum for BackdropCMS.org.
https://forum.backdropcms.org/
4 stars 10 forks source link

Can we have a code formatting/hightlighting library? #30

Closed serundeputy closed 4 years ago

serundeputy commented 6 years ago

On my site I use highlight.js by putting the following in page.tpl.php

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

this way we can callout inline code references and block code references that could be useful in many posts and howtos.


PR: https://github.com/backdrop-ops/forum.backdropcms.org/pull/34

serundeputy commented 6 years ago

Some examples: screen shot 2017-11-03 at 7 42 23 pm

Styles:

screen shot 2017-11-03 at 7 43 58 pm
docwilmot commented 6 years ago

I'll leave this one for @jenlampton to decide.

jenlampton commented 6 years ago

I wonder if there's a markdown filter we could use instead? (or in addition?)

One of the things that frustrates me to no end is that markdown syntax isn't supported by pantheon's ticketing system. Most people working on Backdrop are likely going to be both in the forums and on GitHub, so it would be good if we could use the same language and tools in both places. Ideally, people will start in the forums and move to GitHub later in the process, so it would be great if what we teach them for the forum would directly apply. That would give people a sense of confidence when they get to the scary issue queue :)

It would be even better if the Makrdown filter worked both on the back end and in the rich-text editor, so we could see styles that work just like @serundeputy 's screenshot. That way before people know the markdown syntax, they can already access some of the more common needs via buttons in the editor.

jenlampton commented 6 years ago

@serundeputy I've merged your PR for now, but I would prefer to see something that's more standard to use long-term.

alexfinnarn commented 6 years ago

I love HighlightJS! Woot!

Looks like HighlightJS has markdown support https://highlightjs.org/download/ but nesting blocks with a PHP block inside of a Markdown style doesn't work when I tried it on https://forum.backdropcms.org/forum-topic/test-post-about-styles. I'm probably doing it wrong...

serundeputy commented 6 years ago

@alexfinnarn check out https://forum.backdropcms.org/forum-topic/test-post-about-styles#comment-33

which attempts to explain the convolution.

alexfinnarn commented 6 years ago

Thanks. I forgot about the extra <code> tags. Seems to work fine for me with those linked instructions.

jenlampton commented 4 years ago

Closing, since we have highlight.js.