JScript multi-language syntax highlight engine improvement (Correction number recognition, add row number)

Source: Internet
Author: User

Haha, I can display the row number at last, and it looks pretty good.

If the original regular expression is not suitable for matching, you can use the soil method directly.

The improvement of row recognition is simple, that is, segmentation by line break.CodeThen, add the number of rows between rows and combine them.


// Split the code into lines, and add row numbers and labels to each line.
VaR _ Lines = Temp. Split ( " \ N " );
VaR _ Newcode =   New Array ();

For ( VaR I = 0 ; I < _ Lines. length; I ++ )
{< br> _ newcode. push ( " $ line " );
_ newcode. push (I + 1 );
_ newcode. push ( " $ linee " );
_ newcode. push (_ lines [I]);
_ newcode. push ( " \ n " );
}

// Recombine rows
Temp = _ Newcode. Join ( "   " );

Download the file to the summary post: JScript multi-language syntax brightening engine (continuously updating)

Below is the improved demo. Enter the code and try it !!! :

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.