Giter Site home page Giter Site logo

nicicalu / syntax-highlighter Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 3.0 501 KB

Effortlessly highlight and format your code for direct pasting into Word documents. Simplify your workflow and present your code professionally.

Home Page: https://syntax-highlighter.k26.ch

CSS 4.82% JavaScript 91.16% HTML 4.02%
syntax-highlighter syntax-highlighting tool word

syntax-highlighter's Introduction

syntax-highlighter's People

Contributors

nicicalu avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

syntax-highlighter's Issues

I've almost added YAML support, need help with registering the function

Hi,
first of all thank you for creating this tool. This is the only good code highlighter that has line numbers and works together with word.
I needed syntax highlighting for YAML so i've wrote a function to add it. I would also create a PR but I cannot figure out how to register my function. For now I've just overrwritten the content of the XML function. Below is the function for YAML support, where do i need to add to make it work as a seperate a new feature?

    /***/ (function(module, exports, __webpack_require__) {
                'use strict';

                var BrushBase = __webpack_require__(22); 
                var regexLib = __webpack_require__(3).commonRegExp; 

                function Brush() {
                    // YAML primarily consists of key-value pairs, lists, dictionaries, and comments
                    this.regexList = [
                        {
                            regex: /^\s*#.*/gm, // YAML comments start with #
                            css: 'comments'
                        },
                        {
                            regex: /#.*$/gm, // Matches comments anywhere on the line
                            css: 'comments'
                        },

                        {
                            regex: /(["'])(?:(?=(\\?))\2.)*?\1/gm, // Matches double or single quoted strings
                            css: 'string' 
                        },
                        {
                            regex: /(\b[a-z0-9_]+\b)(\s*:)/gim, // Matches keys in key-value pairs
                            css: 'keyword' 
                        },
                        {
                            regex: /(\s*-\s*)(?=[\w])/g, // Matches hyphens in lists
                            css: 'string' 
                        },
                        {
                            regex: /\b(true|false|null)\b/gi, // Boolean and null values
                            css: 'value' 
                        },
                        {
                            regex: /\b(\d+\.?\d*)\b/g, // Matches numbers
                            css: 'value' 
                        }
                    ];

                };

                Brush.prototype = new BrushBase();
                Brush.aliases = ['yml'];
                module.exports = Brush;

    /***/ }),

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.