Comments
-
Greg Hurrell
Product changed:
- From: wincent.dev
- To: wikitext
-
Greg Hurrell
Status changed:
- From: new
- To: open
-
Greg Hurrell
This is one option which wouldn't require any server-side shenanigans; just highlighting done on the client-side in the browser via JavaScript:
Discovered here.
-
Greg Hurrell
See also:
-
Greg Hurrell
Another similar project (much more recent, dated 2009):
-
Greg Hurrell
Would make sense to combine this with automatic line-numbering a well, I think.
-
Greg Hurrell
Ok, the wikitext side of this is now implemented.
The rest of the work has to be done in the application layer.
-
Greg Hurrell
Product changed:
- From: wikitext
- To: wincent.dev
-
Greg Hurrell
On adding line numbers:
- on line numbers getting copied: http://trac.edgewall.org/ticket/7055
- toggleable numbers: http://www.leancrew.com/all-this/2007/12/source-code-line-numbers-and-javascript/
- http://meddle.dzygn.com/eng/weblog/line.numbers/
- http://drupal.org/node/393500
- http://softwaremaniacs.org/forum/highlightjs/1362/
Check out the source code browser on any code.google.com project (for example) to see an example of a line number implementation which doesn't pollute copied text with unwanted line numbers, at the cost of being unwrapped (which is what my "pre" block CSS does currently anyway).
-
Greg Hurrell
Here's a little test I just did in the Safari snippet editor:
<style type="text/css"> pre span.line-number { counter-increment: line-number; text-align: right; float:left; padding-right: 1em; width: 3em; color: gray; } pre span.line-number:before { content: counter(line-number); } </style> <pre class="c-syntax"><span class="line-number"></span>void normalize_options(options_t *options) <span class="line-number"></span>{ <span class="line-number"></span> if (options->recurse == -1) <span class="line-number"></span> options->recurse = 0; <span class="line-number"></span> if (options->regex == -1) <span class="line-number"></span> options->regex = 0; <span class="line-number"></span> if (options->case_insensitive == -1) <span class="line-number"></span> options->case_insensitive = 0; <span class="line-number"></span> if (options->global == -1) <span class="line-number"></span> options->global = 0; <span class="line-number"></span> if (options->preview == -1) <span class="line-number"></span> options->preview = 0; <span class="line-number"></span> if (options->gui == -1) <span class="line-number"></span> options->gui = 0; <span class="line-number"></span> if (options->dry_run == -1) <span class="line-number"></span> options->dry_run = 0; <span class="line-number"></span> if (options->verbose == -1) <span class="line-number"></span> options->verbose = 0; <span class="line-number"></span>}</pre>
Works in Firefox too.
-
Greg Hurrell
Ok, line number is now implemented in the app.
-
Greg Hurrell
Ok, the syntax coloring engine is done too.
Here's a preview; bear in mind the colors are quite garish and ugly and are only for debugging purposes, and I've only added a few highlighting rules so there is still quite a bit more to be added:
-
Greg Hurrell
Status changed:
- From: open
- To: closed
Add a comment
Comments are now closed for this issue.