Go to file
2011-01-10 11:36:22 +00:00
code MINOR Added CSS brush to syntax highlighting includes 2011-01-10 11:36:22 +00:00
css MINOR: dl styles. PATCH via ajshort 2010-07-23 10:34:49 +00:00
docs/en MINOR: updated documentation for permalinks 2010-10-22 02:09:15 +00:00
images ENHANCEMENT: moved away from DebugView display / layout 2010-03-04 10:18:02 +00:00
javascript ENHANCEMENT Added custom "SS" brush for syntax highlighting (needs work) 2011-01-10 11:36:21 +00:00
templates BUGFIX: fixed pagination of search results not loading on pages other than the first 2010-12-22 08:44:46 +00:00
tests BUGFIX Improved DocumentationParser to avoid empty lines in pre tags, deal with normal markdown code blocks, and html encode lines within pre tags 2011-01-10 10:59:22 +00:00
thirdparty ENHANCEMENT Added thirdparty/syntaxhighlighter (removed tests/ and compass/ folders for security reasons) 2011-01-10 10:59:29 +00:00
_config.php FEATURE: initial commit of sapphire documentation viewer module. Parses each module with a docs folder and generates formatted trees for each. Parses single markdown files for display 2010-03-04 04:39:02 +00:00
LICENSE FEATURE: initial commit of sapphire documentation viewer module. Parses each module with a docs folder and generates formatted trees for each. Parses single markdown files for display 2010-03-04 04:39:02 +00:00
README.md MINOR Enabled markdown code block parsing logic, README for syntax highlighting, loading syntaxhighlighter JS and CSS 2011-01-10 10:59:31 +00:00

Documentation Viewer Module

Maintainer Content

Requirements

  • Tested on 2.4 and trunk

Summary

Read nested documentation files from the /docs/ folder in modules. To read documentation go to yoursite.com/dev/docs/.

It is likely this will be integrated into the core in future versions once it is polished.

For more documentation on how to use the module please read /docs/Writing-Documentation.md (or via this in /dev/docs/sapphiredocs/Writing-Documentation)

Syntax Highlighting

The custom Markdown parser can render custom prefixes for code blocks, and render it via a javascript syntax highlighter.

In:

:::php
my sourcecode

Out:

<pre class="brush: php">
my sourcecode
</pre>

To include the syntax highlighter source, add the following to your DocumentationViewer->init():

Requirements::javascript(THIRDPARTY_DIR .'/jquery/jquery.js');
Requirements::javascript('sapphiredocs/thirdparty/syntaxhighlighter/scripts/shCore.js');
Requirements::javascript('sapphiredocs/thirdparty/syntaxhighlighter/scripts/shBrushJScript.js');
Requirements::javascript('sapphiredocs/thirdparty/syntaxhighlighter/scripts/shBrushPHP.js');
Requirements::javascript('sapphiredocs/thirdparty/syntaxhighlighter/scripts/shBrushXML.js');
// ... any additional syntaxes you want to support
Requirements::combine_files(
	'syntaxhighlighter.js',
	array(
		'sapphiredocs/thirdparty/syntaxhighlighter/scripts/shCore.js',
		'sapphiredocs/thirdparty/syntaxhighlighter/scripts/shBrushJScript.js',
		'sapphiredocs/thirdparty/syntaxhighlighter/scripts/shBrushPHP.js',
		'sapphiredocs/thirdparty/syntaxhighlighter/scripts/shBrushXML.js'
	)
);

Requirements::javascript('sapphiredocs/javascript/DocumentationViewer.js');

// css
Requirements::css('sapphiredocs/thirdparty/syntaxhighlighter/styles/shCore.css');
Requirements::css('sapphiredocs/thirdparty/syntaxhighlighter/styles/shCoreDefault.css');
Requirements::css('sapphiredocs/thirdparty/syntaxhighlighter/styles/shThemeRDark.css');

You can overload the DocumentationViewer class and add a custom route through Director::addRule() if you prefer not to modify the module file.