Now I know the reason for failing to make highlight.js work on my blog yesterday. It is because of Blogger's dynamic view, which is the real thing that I'm going to give up using forever. For details, refer to my newer post.
(updated on 8/1/14 09:45 GMT)
(updated on 8/1/14 09:45 GMT)
Thanks to Chris, I know more ways of embedding source code lists now.
Confucius said that we need to practice what we've learnt. So this is my sample usage of highlight.js.
In my previous post titled Fast Compilation and Execution of Source Code, I included the following sample
makefile
:
hello : hello.c gcc -o hello hello.c clean: rm -f helloNote: See the note of making a makefile in the previous blog post. In order to include this list, I used Alex Gorbatchev's SyntaxHighlighter to do this.
<pre class="brush: text;">hello : hello.c gcc -o hello hello.c clean: rm -f hello </pre>This template looks pretty, but there's some inadequacies for me:
- Makefile (and other popular languages as well) support
- Multiple language syntax detection: For example, in the second source code list, I try to explain how to write the HTML code for including a source code list of another language (In this case, it's makefile).
@requires_authorization
def somefunc(param1='', param2=0):
r'''A docstring'''
if param1 > param2: # interesting
print 'Gre\'ater'
return (param2 - param1 + 1) or None
class SomeClass:
pass
>>> message = '''interpreter
... prompt'''
Code copied from the live demo of highlight.js.
No comments:
Post a Comment