All Projects → leafo → lua-syntaxhighlight

leafo / lua-syntaxhighlight

Licence: other
A code syntax to HTML highlighter using lexers from Textadept

Programming Languages

lua
6591 projects
MoonScript
45 projects
Makefile
30231 projects

Projects that are alternatives of or similar to lua-syntaxhighlight

Dot Hugo Documentation Theme
Dot - Hugo Documentation Theme
Stars: ✭ 162 (+710%)
Mutual labels:  syntax-highlighting
Zerobranestudio
Lightweight Lua-based IDE for Lua with code completion, syntax highlighting, live coding, remote debugger, and code analyzer; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and other Lua interpreters on Windows, macOS, and Linux
Stars: ✭ 2,255 (+11175%)
Mutual labels:  syntax-highlighting
Intellij Hcl
HCL language support for IntelliJ platform based IDEs
Stars: ✭ 207 (+935%)
Mutual labels:  syntax-highlighting
Brackeys Ide
👨‍💻 Brackeys IDE is a fast and free multi-language code editor for Android.
Stars: ✭ 154 (+670%)
Mutual labels:  syntax-highlighting
Bim
small terminal text editor with syntax highlighting
Stars: ✭ 174 (+770%)
Mutual labels:  syntax-highlighting
Vscode Vlang
V Language extension for Visual Studio Code.
Stars: ✭ 190 (+850%)
Mutual labels:  syntax-highlighting
Kilua
A minimal text-editor with lua scripting.
Stars: ✭ 158 (+690%)
Mutual labels:  syntax-highlighting
Gatsby Remark Vscode
Gatsby plugin to provide VS Code’s syntax highlighting to Markdown code fences
Stars: ✭ 245 (+1125%)
Mutual labels:  syntax-highlighting
Css3
The most complete CSS support for Sublime Text
Stars: ✭ 178 (+790%)
Mutual labels:  syntax-highlighting
Codeview
Android Code Highlighter
Stars: ✭ 204 (+920%)
Mutual labels:  syntax-highlighting
Biosyntax
Syntax highlighting for computational biology
Stars: ✭ 164 (+720%)
Mutual labels:  syntax-highlighting
Kuroi.vim
A dark Vim colorscheme
Stars: ✭ 174 (+770%)
Mutual labels:  syntax-highlighting
Highlight
Source code to formatted text converter
Stars: ✭ 191 (+855%)
Mutual labels:  syntax-highlighting
Codehub
A UWP GitHub Client
Stars: ✭ 162 (+710%)
Mutual labels:  syntax-highlighting
Notehighlight2016
Source code syntax highlighting for OneNote 2016 and OneNote for O365 . NoteHighlight 2013 port for OneNote 2016 (32-bit and 64-bit)
Stars: ✭ 2,907 (+14435%)
Mutual labels:  syntax-highlighting
Modern Cpp Font Lock
C++ font-lock for Emacs
Stars: ✭ 159 (+695%)
Mutual labels:  syntax-highlighting
Ngx Highlightjs
Angular syntax highlighting module
Stars: ✭ 187 (+835%)
Mutual labels:  syntax-highlighting
Vim Afterglow
Vim adaptation of the Afterglow colorscheme
Stars: ✭ 248 (+1140%)
Mutual labels:  syntax-highlighting
Npp Vs2012 Dark
Visual Studio 2012 Dark Theme for Notepad++
Stars: ✭ 236 (+1080%)
Mutual labels:  syntax-highlighting
Prettyprint
Beautifully formatted output for your terminal 🌈
Stars: ✭ 195 (+875%)
Mutual labels:  syntax-highlighting

syntaxhighlight

test

Highlights code into HTML using lexers from Textadept.

local sh = require("syntaxhighlight")

local html = sh.highlight_to_html("lua", [[

local function hello_world(times)
  for i=1,times do
    print("hello world")
  end
end

]])

print(html)

Output:

<pre class="sh_highlight"><span class="sh_keyword">local</span> <span class="sh_keyword">function</span> <span class="sh_identifier">hello_world</span><span class="sh_operator">(</span><span class="sh_identifier">times</span><span class="sh_operator">)</span>
  <span class="sh_keyword">for</span> <span class="sh_identifier">i</span><span class="sh_operator">=</span><span class="sh_number">1</span><span class="sh_operator">,</span><span class="sh_identifier">times</span> <span class="sh_keyword">do</span>
    <span class="sh_function">print</span><span class="sh_operator">(</span><span class="sh_string">&quot;hello world&quot;</span><span class="sh_operator">)</span>
  <span class="sh_keyword">end</span>
<span class="sh_keyword">end</span>
</pre>

Interface

highlight_to_html(language_name, code, opts={})

Highlights code using the lexer for language_name. All input code is HTML escaped and is safe to embed directly into a page.

Options:

  • class_prefix -- default sh_: Prefix put in front of every class name generated for each element
  • bare -- default false: Set to true to not return the code wrapped in a pre tag

License

Files located in syntaxhighlight/textadept/

See respective authors on top of each file

The MIT License

Copyright (c) 2007-2019 Mitchell

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Everything else

The MIT License

Copyright (c) 2020 Leaf Corcoran

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].