Git Product home page Git Product logo

prettify-matlab's People

Contributors

amroamroamro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

prettify-matlab's Issues

Adding "string" support

This issue concerns the formatting of double-quoted strings, added in R2016b.

This sort of formatting works on GitHub, but not in e.g. SO:

chr = 'this is a char array';
str = "this is a string";

vs.

image

[EDIT]
Based on the existing example, this code should do the trick (credit: @crisluengo[1]):

        // single- or double-quoted strings: allow for escaping with '', no multilines
		[PR.PR_STRING, /^('(?:[^']|'')*')|("(?:[^"]|"")*")/, null]

or perhaps this:

        // single-quoted strings: allow for escaping with '', no multilines
        [PR.PR_STRING, /^'(?:[^']|'')*'/, null],

	// double-quoted strings
	[PR.PR_STRING, /^("(?:[^"]|"")*")/, null],

IE error on extra commas in array constructs

IE (at least up to IE 8) fails if there's a comma after the last item in a list. eg.

var list = [1,2,3,];

These occur on lines 129, 149, and 163 of the output lang-matlab.js; removing them fixes everything for IE.

Prettify Ext. and Default Languages

Sorry to write again, but I'm trying to see if prettify can be used for anything useful.

Is it correct that the lang=matlab needs to be set as parameter torun_prettify.js since MATLAB is not part of the default supported languages in prettify ?
If using e.g. c++ I do not need to specifylang=cpp since this is a default language ?
If using pretttify.js instead of run_pretttify.js, I need to link each of the non-default language js files, e.g. lang-matlab.js ?
But if calling just pretttify.js I also need to call the function prettyPrint(); on my page to get it started ?
Why would you then ever call pretttify.js and not run_pretttify.js ?

Looking at the sample below, why is vb and c++ rendered differently ?

https://jsfiddle.net/cpede/1gkc7fjw/

Thanks for helping me.
-cpede

Transpose operator interpreted as string

It is a common problem in syntax highlight for Matlab/Octave.
If you try this code
x = linspace (0,1,100).';
y = rand (1,100);
plot(x,y);

You see that everything after the apostrophe symbol is interepted as string. One solution is to do apostrophe matching and if there is no match assume it is the transpose operator.

Inconsistent colors for array size printout

When displaying a struct containing non-scalar arrays, something like the following is printed out:

ans = 

      form: 'pp'
    breaks: [1x40 double]
     coefs: [39x4 double]
    pieces: 39
     order: 4
       dim: 1

This gets highlighted as follows (example in SO):
Highlighting example
Note the x40 and x4. I would either expect everything to be black, or all numbers to be brown and x's to be black.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.