Closed Bug 862003 Opened 11 years ago Closed 11 years ago

Switch to a better syntax highligher

Categories

(developer.mozilla.org Graveyard :: Editing, defect, P2)

All
Other
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: openjck, Unassigned)

References

Details

(Whiteboard: [specification][type:change][dev-ecosystem])

What feature should be changed? Please provide the URL of the feature if possible.
==================================================================================
The syntax highlighter we currently use on MDN has a number of problems. See the dependent bugs for some examples.

What problems would this solve?
===============================
See the list of dependent bugs as just some examples of problems that would be solved by switching to a better syntax highlighter.

Who would use this?
===================
Readers would primarily benefit from a better highlighter, but this would also solve some frustrations that editors experience while trying to document their code properly.

What would users see?
=====================
Readers should see code samples that are highlighted more accurately. It sounds like authors should not see any difference.

What would users do? What would happen as a result?
===================================================
Readers would not need to actively do anything to see the effects of a better syntax highlighter, and it sounds like authors would not need to do anything differently either.

Is there anything else we should know?
======================================
Component: General → Editing
Whiteboard: [specification][type:change] → [specification][type:change][dev-ecosystem]
We mentioned Prism as being one good option.
My blog uses PrismJS (http://prismjs.com/) and I like it a lot.  Extensible and oft-updated.  Support for CSS/SCSS, JS/Coffeescript, HTML, and C-Like.  Gets my vote.
Blocks: 821261
Blocks: 793225
Blocks: 774103
Priority: -- → P2
Sounds like a plan to me. I certainly don't object to improving our syntax highlighting!
David asked me to list the languages we need to highlight, so here we go:

JavaScript
C++
Python
Perl
Java
Bash
CSS
XML
PHP
XML

Someone mentioned JSON -- but wouldn't JavaScript cover that? If that's not adequate, then add JSON to the list.

Some of those we don't use often (but will, more, as we add more content about how to handle the server side of operations -- that'd be the Perl and Python stuff in particular).
We need WebIDL and HTML too.
Sheppy just thought of SVG and I add MathML.
Oops, did I leave HTML off? My mistake.

WebIDL would be a nice to have but IMHO not mandatory; we actually try to discourage showing IDL directly. :)

SVG would be good if it's available separately from XML.
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/7d3f228459463bab1cff99adc34e48a53402c8e3
fix bug 862003 - Implement Prism syntax highlighter

https://github.com/mozilla/kuma/commit/39d7db88dbdd074a6f295c2932734489a8973bc1
Merge pull request #1025 from darkwing/syntax-862003-waffle

fix bug 862003 - Implement Prism syntax highlighter
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
(In reply to Eric Shepherd [:sheppy] from comment #4)
> Someone mentioned JSON -- but wouldn't JavaScript cover that? If that's not
> adequate, then add JSON to the list.
For JSON, I think it's important be able to visually differenciate keys and values. Most JS parsers consider both keys and values as string and color both with the same color.
Are the dependencies of this bug (bug 774103, bug 793225, bug 821261) resolved by this?
Flags: needinfo?(dwalsh)
Only 821261 needs to be addressed, although we can use the JavaScript lighter for that, IMO.
Flags: needinfo?(dwalsh)
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.