All Projects → amroamroamro → Prettify Matlab

amroamroamro / Prettify Matlab

Licence: mit
MATLAB syntax highlighting for google-code-prettify

Programming Languages

javascript
184084 projects - #8 most used programming language
matlab
3953 projects

Projects that are alternatives of or similar to Prettify Matlab

Hugo Tranquilpeak Theme
A gorgeous responsive theme for Hugo blog framework
Stars: ✭ 686 (+6760%)
Mutual labels:  syntax-highlighting
Semshi
🌈 Semantic Highlighting for Python in Neovim
Stars: ✭ 758 (+7480%)
Mutual labels:  syntax-highlighting
New Moon
🌙 ‎ The optimized dark theme for web development.
Stars: ✭ 918 (+9080%)
Mutual labels:  syntax-highlighting
Rich
Rich is a Python library for rich text and beautiful formatting in the terminal.
Stars: ✭ 31,664 (+316540%)
Mutual labels:  syntax-highlighting
Codeview Android
Display code with syntax highlighting ✨ in native way.
Stars: ✭ 748 (+7380%)
Mutual labels:  syntax-highlighting
Imguicolortextedit
Colorizing text editor for ImGui
Stars: ✭ 772 (+7620%)
Mutual labels:  syntax-highlighting
Vscode Styled Components
Syntax highlighting for styled-components
Stars: ✭ 680 (+6700%)
Mutual labels:  syntax-highlighting
Illuminate Js
Syntax Highlighter made for and in ES6. Works both on Node and Browser (React too!).
Stars: ✭ 26 (+160%)
Mutual labels:  syntax-highlighting
Nord Visual Studio Code
An arctic, north-bluish clean and elegant Visual Studio Code theme.
Stars: ✭ 749 (+7390%)
Mutual labels:  syntax-highlighting
Sublimetext
Caddyfile syntax highlighting for Sublime Text 3
Stars: ✭ 17 (+70%)
Mutual labels:  syntax-highlighting
Bat
A cat(1) clone with wings.
Stars: ✭ 30,833 (+308230%)
Mutual labels:  syntax-highlighting
Matlab Schemer
Apply and save color schemes in MATLAB with ease.
Stars: ✭ 708 (+6980%)
Mutual labels:  syntax-highlighting
Asciidoc Kate
AsciiDoc/AsciiDoctor syntax highlighting plugin for Kate editor/KatePart
Stars: ✭ 5 (-50%)
Mutual labels:  syntax-highlighting
Pdbpp
pdb++, a drop-in replacement for pdb (the Python debugger)
Stars: ✭ 693 (+6830%)
Mutual labels:  syntax-highlighting
Clygments
🎨 Code highlighting using Pygments in Clojure
Stars: ✭ 22 (+120%)
Mutual labels:  syntax-highlighting
Ngx Markdown
Angular markdown component/directive/pipe/service to parse static, dynamic or remote content to HTML with syntax highlight
Stars: ✭ 687 (+6770%)
Mutual labels:  syntax-highlighting
Rsyntaxtextarea
A syntax highlighting, code folding text editor for Java Swing applications.
Stars: ✭ 767 (+7570%)
Mutual labels:  syntax-highlighting
Vscode Smarty
Smarty syntax highlight extension for Visual Studio Code
Stars: ✭ 10 (+0%)
Mutual labels:  syntax-highlighting
Npp Robot
📝 Notepad++ syntax highligher for Robotframework automation framework
Stars: ✭ 25 (+150%)
Mutual labels:  syntax-highlighting
6502 Npp Syntax
Notepad++ Syntax Highlighting for 6502 Assembly (and NESASM)
Stars: ✭ 17 (+70%)
Mutual labels:  syntax-highlighting

MATLAB syntax highlighting for Google Code Prettify

Build Status Build Status devDependency Status Built with Grunt License

An implementation of MATLAB syntax highlighting for google-code-prettify.

The following constructs are recognized:

  • single line and block comments (% comment and %{,%})
  • quoted string ('hello world')
  • number literals (1, -2.5, 1i, 2.9E-5, etc...)
  • shell escape (!touch filename)
  • line continuation (...)
  • transpose operator (x' and x.')
  • command prompt (>> now)
  • error/warning messages (??? Error in ... and Warning: ...)
  • parentheses, brackets, braces ((), [], {})
  • other operators (<>[email protected]&;,:!-+*^.|\/)
  • MATLAB language keywords (if, else, end, etc...)
  • some special variables and constants (inf, nan, varargin, etc..)
  • user-defined indentifiers (function and variable names not matched in previous steps)

The "full" version also adds highlighting for MATLAB functions:

(Since this increases the resulting script size, a separate "lite" version is also available which excludes function names detection).

The project was inspired by the similar Mathematica.SE syntax highlighter.

Build

Requirements: Node.js and the NPM package manager.

To rebuild the project, run the following in the command line:

$ cd prettify-matlab
$ npm install
$ npm run build

# (optional) run unit tests
$ npm test

First this will install build dependencies, then generate the output javascript and stylesheet files in the dist directory using the source templates from the src directory.

dist/
|
|-- js/
|    |-- full/
|    |    |-- lang-matlab.js      # code-prettify extension (full version)
|    |    |-- lang-matlab.min.js  # and minified version
|    |
|    |-- lite/
|         |-- lang-matlab.js      # code-prettify extension (lite version)
|         |-- lang-matlab.min.js  # and minified version
|
|-- css/
|    |-- matlab.css               # optional skin for code-prettify
|    |-- matlab.min.css           # and minified version
|
|-- userscripts/
     |-- prettify-matlab.user.js                  # userscripts for
     |-- switch-lang.user.js                      #  Stack Overflow
     |-- prettify-mathworks-answers.user.js       # userscripts for
     |-- prettify-mathworks-fileexchange.user.js  #  various MathWorks
     |-- prettify-mathworks-examples.user.js      #  websites

Usage: Extension

Version Source
Full Source
Lite Source

To apply the MALTAB syntax highlighting on code snippets in your own web pages, first include the prettify scripts and stylesheets in your document (as explained in the code-prettify project documentation). Next include the MATLAB language extension, and place your source code inside a preformatted HTML tag as follows:

<html>
<head>
<title>MATLAB</title>
<link rel="stylesheet" type="text/css" href="prettify.css" />
<script src="prettify.js"></script>
<script src="lang-matlab.js"></script>
</head>

<body onload="prettyPrint();">
<pre class="prettyprint lang-matlab">
% example code
x = [1, 2, 3]';
fprintf('sum(x^2) = %f\n', sum(x.^2));
</pre>
</body>
</html>

When PR.prettyPrint() is called, marked sections will be pretty-printed, and the default styles will be applied. You can customize them with your own, or use the provided stylesheet which has a color scheme inspired by that of the MATLAB IDE (with some modifications).

See the demo page for a demonstration.

UPDATE: The MATLAB extension is now integrated upstream in google/code-prettify. So you can use the auto-loader to directly load both code-prettify along with the MATLAB extension via one URL:

<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?lang=matlab"></script>

Usage: Userscripts

For instructions on installing userscripts for various browsers, see this page. Also check out the wiki for sample screenshots.

Stack Overflow

Apply MATLAB syntax highlighting on Stack Overflow and other Stack Exchange sites. The script is only activated on questions tagged as matlab.

Source Install

In addition, a separate userscript is included to allow switching the language used by the prettifier. It adds a small button to the top-right corner of each code block, with an attached drop-down menu to allow language selection.

Source Install

UPDATE: Stack Overflow recently integrated MATLAB syntax support, so you should get proper syntax highlighting by default. This userscript is still useful if you want to get full highlighting for function names as well as the customized stylesheet which applies colors resembling the MATLAB editor.

MathWorks MATLAB Answers

Apply MATLAB syntax highlighting on MATLAB Answers.

Source Install

MathWorks File Exchange

Apply MATLAB syntax highlighting on File Exchange.

Source Install

MathWorks MATLAB Examples

Apply MATLAB syntax highlighting on MATLAB Examples.

Source Install

License

Project released under the MIT License.

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].