Sponsored Content
Top Forums Web Development Vue.js component: Beautiful code highlighter Post 303034760 by Neo on Saturday 4th of May 2019 11:15:19 PM
Old 05-05-2019
Also, this is a possibility:

GitHub Highlight.js

Quote:
Highlight.js is a syntax highlighter written in JavaScript. It works in the browser as well as on the server. It works with pretty much any markup, doesn't depend on any framework, and has automatic language detection.

Reference: Web Page: highlight.js

Image
 

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

like to share this beautiful shell script

Hello Everybody I recently got this beautiful shell script from my friend. I like to share it with every body as I am bit new to shell scripting enviorment. I hope people in this site will like it. It is related to checking the filesystem threshold limit. After getting threshold limit of... (0 Replies)
Discussion started by: girish.batra
0 Replies

2. Web Development

A simple UNIXtime component in Vue.js

A shout out to Scott who gave me a helping hand to turn a simple sample Vue.js app I wrote yesterday into a Vue.js component: Vue.component("unix-time", { template: `<div class="time">{{unixtime}}</div>`, data() { return { unixtime: "" }; }, methods: { ... (1 Reply)
Discussion started by: Neo
1 Replies

3. Web Development

Turning jQuery Code into Vue.js

The following is some code I am working on the replace our navbar (someday) with a Vue component. Vue.component("unix-navbar", { template: `<div class="neo-table-border vuenavbar"><div class="flex-item" style="margin-bottom:10px;padding-top:13px;"><a class="vuenavbarhome"... (19 Replies)
Discussion started by: Neo
19 Replies

4. Web Development

Simple Vue.js Component to Redirect to External Web Page Using Vue Router

Vue Router has some quirks and on of the quirks is that it is not reliable when adding external links using the vue-router library. After struggling with many solutions, I have found that creating a simple Vue.js component like this one seems to work the best (so far): Component Example: ... (0 Replies)
Discussion started by: Neo
0 Replies

5. Web Development

Vue JS 2 Tutorial by The Net Ninja: A Recommended Vue.js Video Tutorial Series

A number of people have asked me how to get started with Vue.js and my reply before today was to Google "Vue.js". That has changed and my recommendation to anyone who wants to learn the fastest growing, easiest to learn and use Vue.js web dev framework is to watch this video tutorial series: ... (0 Replies)
Discussion started by: Neo
0 Replies

6. Web Development

Documenting Installation Problem with vue-beautiful-chat

REF: https://github.com/mattmezza/vue-beautiful-chat $ git clone https://github.com/mattmezza/vue-beautiful-chat.git Cloning into 'vue-beautiful-chat'... remote: Enumerating objects: 534, done. remote: Total 534 (delta 0), reused 0 (delta 0), pack-reused 534 Receiving objects: 100%... (2 Replies)
Discussion started by: Neo
2 Replies
Syntax::Highlight::Engine::Simple(3pm)			User Contributed Perl Documentation		    Syntax::Highlight::Engine::Simple(3pm)

NAME
Syntax::Highlight::Engine::Simple - Simple Syntax Highlight Engine VERSION
This document describes Syntax::Highlight::Engine::Simple SYNOPSIS
use Syntax::Highlight::Engine::Simple; # Constractor $highlight = Syntax::Highlight::Engine::Simple->new(%hash); # Parameter configuration $highlight->setParams(%hash); # Syntax definision and addition $highlight->setSyntax(%hash); $highlight->appendSyntax(%hash); # Perse $highlight->doFile(%hash); $highlight->doStr(%hash); # Utilities $highlight->array2regexp(%hash); $highlight->getClassNames(%hash); DESCRIPTION
This is a Syntax highlight Engine. This generates a part of HTML string by marking up the input string with span tags along the given rules so that you can easily coloring with CSS. Advantage is the simpleness. This provides a simple way to define the highlighting rules by packing the complicated part of it into regular expression. Also, This works faster than similar highlight solutions on rough benchmarks. Here is a working example of This module. http://jamadam.com/dev/cpan/demo/Syntax/Highlight/Engine/Simple/ INTERFACE
new new constractor calls for following arguments. type File type. This argument causes specific sub class to be loaded. syntax With this argument, you can assign rules in constractor. setParams This method calls for following arguments. html_escape_code_ref HTML escape code ref. Default subroutine escapes 3 characters '&', '<' and '>'. setSyntax Set the rules for highlight. It calls for a argument syntax in array. $highlighter->setSyntax( syntax => [ { class => 'tag', regexp => "<.+?>", }, { class => 'quote', regexp => "'.*?'", container => 'tag', }, { class => 'wquote', regexp => '".*?"', container => 'tag', }, { class => 'keyword', regexp => 'somekeyword', container => ['tag', 'quote', 'wquote'], }, ] ); The array can contain rules in hash which is consists of 3 keys, class, regexp and container. class This appears to the output SPAN tag. regexp Regular expression to be highlighted. container Class names of allowed container. It can be given in String or Array. This restricts the regexp to stand only inside of the classes. This parameter also works to ease the regulation some time. The highlighting rules doesn't stand in any container in default. This parameter eliminates it. appendSyntax Append syntax by giving a hash. $highlighter->setSyntax( syntax => { class => 'quote', regexp => "'.*?'", container => 'tag', } ); doStr Highlighting input string and returns the marked up string. This method calls for following arguments. str String. tab_width Tab width for tab-space conversion. -1 for disable it. -1 is the default. $highlighter->doStr( str => $str, tab_width => 4 ); doFile Highlighting the file and returns the marked up string. This method calls for following arguments. file File name. tab_width Tab width for tab-space conversion. -1 for disable it. -1 is the default. encode Set the encode of file. utf8 is the default. $highlighter->doStr( str => $str, tab_width => 4, encode => 'utf8' ); array2regexp This is a utility method for converting string array to regular expression. getClassNames Returns the class names in array. DIAGNOSTICS
"doStr method got undefined value" "File open failed" CONFIGURATION AND ENVIRONMENT
Syntax::Highlight::Engine::Simple requires no configuration files or environment variables. Specific language syntax can be defined with sub classes and loaded in constructor if you give it the type argument. DEPENDENCIES
UNIVERSAL::require encoding INCOMPATIBILITIES
None reported. BUGS AND LIMITATIONS
No bugs have been reported. Please report any bugs or feature requests to "bug-syntax-highlight-engine-Simple@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. SEE ALSO
Syntax::Highlight::Engine::Simple::HTML Syntax::Highlight::Engine::Simple::Perl AUTHOR
Sugama Keita "<sugama@jamadam.com>" LICENCE AND COPYRIGHT
Copyright (c) 2008, Sugama Keita "<sugama@jamadam.com>". All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. perl v5.12.4 2011-07-07 Syntax::Highlight::Engine::Simple(3pm)
All times are GMT -4. The time now is 01:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy