By tsangk
Description
Uses the Syntax Highlighter Library in alexgorbatchev.com.
The type attribute can be any of the below:
- C++: cpp
- C#: csharp
- CSS: css
- Java: java
- Javascript: jscript
- PHP: php
- Pythod: python
- Ruby: ruby
- SQL: sql
- VisualBasic: vb
- XML: xml
- Perl: perl
Code
[[include :snippets:syntax type=cpp]]
int main()
{
printf("some code here like this.");
}
[[include :snippets:syntax-end]]
renders this:
Thanks to tsangk for this great snippet: conditional-blocks
text above inserted with:
[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]
Other snippets posted by tsangk
URL Title with Slash Redirect - 04 Jan 2018 11:32
404 (Page does not exist) Redirect - 20 Nov 2012 11:40
Custom HTML Blocks - 25 Oct 2012 11:30
Conditional Blocks - 15 Feb 2012 00:36
Rate this solution
If you think this solution is useful — rate it up!
The default font-size is a bit to big for my taste… Is it possible to change it?
The system can't find brush for both shell and bash - will it be added?
According to this list of brushes, the bash shell brush is already available. Is this what you wanted elbahek? —> Example of it being used.
If that's the case, then it just needs to be added to this snippet. If tsangk hasn't done it later on, I'll add it myself. I should be head-first into exam revision at the moment, so I'll avoid doing it just yet.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Please add a bash brush
I need code blocks with C# highlighting and the regular Wikidot ones don't support this… so thanks! ;-)
Edit: Actually, I had to use < just to get a less-than symbol to show up on the page, otherwise it broke it. Am going to use the C++ highlighting in the default wikidot code blocks for now.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Is there any way to update this to version 3.0.83? The new version handles several more brushes. http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/
Groovy is supported, according to the SyntaxHighlighter site
http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/
but when I use that on site, it displays a popup saying: Syntax Highlighter
Can't find brush for: Groovy
James, I started this last night on the Syntax Highlighter for Wikidot but I have assignments to do…. xD
Here is what I got done:
http://my-sandbox.wikidot.com/start
Kenneth Tsang (@jxeeno)
Okay :-)
This highlighter looks a lot better than the Wikidot's one. I'm going to see if its possible to make a highlighter for Wikidot's syntax xD
Kenneth Tsang (@jxeeno)
Yes Please!!!
I remember making a design for this: Community Wish #71
That would be great. I'm looking forward to seeing Wikidot's design for the new editor… so perhaps it could be suggested then, once the basics have been drawn up @ the projects site.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
yes.
[[include :snippets:syntax-start type=java]]
/**
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}
[[include :snippets:syntax-end]]
Kenneth Tsang (@jxeeno)
Awesome. Wasn't sure if it was just C++
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Does't work. Show error, that Java brush not found and on the page I see ");" chars.