2 ms·
The main website it was on no longer exists, but there are bits and pieces here and there. http://code.ohloh.net/project?pid=LOfjD4AHjNo&prevcid=1&browser=Defa
by romaniv 14y ago
The main website it was on no longer exists, but there are bits and pieces here and there.
http://code.ohloh.net/project?pid=LOfjD4AHjNo&prevcid=1&browser=Default&did=libs%2FDoc&cid=ks-xq0gsZHA http://code.ohloh.net/project?pid=LOfjD4AHjNo&prevcid=1&...
doc_code2html() takes PHP code as argument, and uses built-in PHP tokenizer to add CSS classes to code. After that, you can use vanilla CSS to color things up. Up to this day this is the simplest and most accurate PHP highlighter I've seen.
doc_getCodeAnchors() takes php code as argument and returns an associative array of anchors. I.e.:
array(
'MyClass.methodName' => array('line' => 3, 'type' => 'class', 'name' => "methodName"),
)
Comments class was a controller that actually displayed files with highlighting and comments, allowing you to add and edit comments.
And yes, I am fully aware of deficiencies of that code, but I still think the core ideas there are pretty cool.