comunic/3rdparty/luminous/api-docs.html

27 lines
9.3 KiB
HTML
Raw Permalink Normal View History

2016-11-19 11:08:12 +00:00
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Luminous Syntax Highlighter</title>
<link rel='stylesheet' type='text/css' href='style/luminous.css'>
<link rel='stylesheet' type='text/css' href='style/geonyx.css'>
<style>
h1{font-size: x-large;}
h2{font-size: large; }
h3{font-size: medium;}
body{ margin:1em; font-family: sans-serif; font-size:12pt;}
.luminous { border: 1px solid #bbb; }
span.inline-code {
background-color: #E7E7E7;
padding: 1px 0.25em;
font-family: monospace;
font-weight: bold;
color: #323232;
border: 1px solid #888;
}
</style>
</head>
<body>
# parent: index<br><h1 id='id_44b325b08041f32d1e5078d7cf27cc5a' ><span>User's API reference</span></h1><div class='toc' style='margin-left:1em'><span class="header">Contents:</span><div class='toc_line' style='padding-left:0em;'><a href='#id_0b79795d3efc95b9976c7c5b933afce2'>Introduction</a></div><div class='toc_line' style='padding-left:0em;'><a href='#id_2386c9a1f1785edee33f374dd2db9b3d'>Basic Functions</a></div><div class='toc_line' style='padding-left:0em;'><a href='#id_83915d1254927f41241e8630890bec6e'>Themes</a></div><div class='toc_line' style='padding-left:0em;'><a href='#id_f4f70727dc34561dfde1a3c529b6205c'>Settings</a></div><div class='toc_line' style='padding-left:1em;'><a href='#id_fe7f01083bc9554f5b913342cafaf5ab'>List of observed settings</a></div><div class='toc_line' style='padding-left:2em;'><a href='#id_ab0cf104f39708eabd07b8cb67e149ba'>Cache</a></div><div class='toc_line' style='padding-left:2em;'><a href='#id_74248c725e00bf9fe04df4e35b249a19'>Misc</a></div><div class='toc_line' style='padding-left:2em;'><a href='#id_b46031bc6e1da09bf56aa837c0596a35'>Formatter</a></div></div><p><h2 id='id_0b79795d3efc95b9976c7c5b933afce2' ><span>Introduction</span></h2>This document gives a relatively high level overview of the user's API. For full API documentation, see the Doxygen HTML files in your distribution.<p>The entirety of the public API is contained within a class called <span class='inline-code'>luminous</span>. This is used as a namespace, the methods within are static, which means you can call them directly without instantiating the class. For those unfamiliar with the syntax or terminology, this just means that you call the functions as normal but place <span class='inline-code'>luminous::</span> in front of it. This is as it is shown on this page.<p>The functions in this namespace interact with a theoretically private singleton object called $luminous_. You should be aware of this if only to avoid overwriting it.<p><h2 id='id_2386c9a1f1785edee33f374dd2db9b3d' ><span>Basic Functions</span></h2>The two main highlighting functions are:<blockquote><span class='inline-code'>luminous::highlight($language, $source, $options=array())</span></blockquote><blockquote><span class='inline-code'>luminous::highlight_file($language, $path, $options=array())</span></blockquote>Note: in versions prior to 0.7, the third parameter was a boolean flag to switch on/off caching. This behaviour is preserved in 0.7 - you can still use a boolean flag instead of the options array. For options, keep reading this page.<p>$language can be a language code (open supported.php in a browser to see a list of what you have available), or your own instance of LuminousScanner.<p>Since 0.6.2 you can ask Luminous to guess the language of a piece of source code with the function:<blockquote><span class='inline-code'>luminous::guess_language($src, $confidence=0.05, $default='plain')</span></blockquote>This will return a valid language code for the most-probable language. $confidence and $default are related: if no scanner is willing to say with above 0.05 (5%) certainty that it owns the source code, then $default is returned. It's probably best to leave this at 0.05.<p><strong>warning:</strong> For obvious reasons, laguage guessing is inherently unreliable. Luminous will try to latch on to unique parts of the language, but this is difficult in languages like C, C# and Java, which are syntactically very similar.<blockquote><span class='inline-code'>luminous::head_html()</span></blockquote>This will output several link and script tags. It tries to determine the correct path to the luminous/ directory relative to the document root, but may fail. In this case, you can override it to set it manually. The settings: 'theme', 'relative-root', 'include-javascript' and 'include-jquery' affect this.<p>Since 0.6.6:<blockquote><span class='inline-code'>luminous::cache_errors()</span></blockquote>Returns a list of cache errors encountered for the most recent highlight, or <span class='inline-code'>FALSE</span> if the cache was not enabled. See the <a hre
</body>
</html>