prod3v3loper/syntaxo

Multi Syntax Highlighter programmed with PHP. Immediately ready for use and can be used anywhere in seconds.

v1.0.0 2019-02-17 15:49 UTC

This package is auto-updated.

Last update: 2024-04-06 13:07:15 UTC


README

Melabuai Logo

Language Packgist PHP Version Packagist Version Repo Siz Code Siz Github Release date MIT License Website

melabuai

🔮 SYNTAXO

Multi Syntax Highlighter programmed with PHP. Immediately ready for use and can be used anywhere in seconds.

Theme Page of this Site

Size

  • HTML
  • CSS
  • LESS
  • SASS
  • JavaScript
  • PHP
  • MySQL
  • Perl And many more...

Usage

Very easy to use and very easy to modify. All you have to do is to include the file, instantiate the class, and call the method method with the string.

Packagist with Composer

This solution extends the vendor autoloader because it calls the files with certain criteria. The extension allows you to call classes wherever the Autloder is involved.

Download Composer local or global. Check for more Tutorial - NetBeans with Composer and Packagist for this one.

You found the package on Packigist - Syntaxo.

Add the Syntaxo dependencie to the composer.json and set the autoload.

{
    "autoload": {
        "psr-4": { "Syn\\": "src/" }
    },
    "require": {
        "prod3v3loper/syntaxo": ">=1.0"
    },

Now run the composer install command with php

php composer.phar install

index.php

require_once __DIR__ . '/vendor/autoload.php';
$HIGHLIGHT = new \Syn\Syntaxo();
echo $HIGHLIGHT->process('
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Highlight</title>
  </head>
  <body>
    <!-- Content -->
  </body>
</html>
');

Git Install

git clone https://github.com/prod3v3loper/syntaxo.git /Users/username/projects/

Get per Git or download and use it.

index.php

require_once './src/Syntaxo.php';
$HIGHLIGHT = new \Syn\Syntaxo();
echo $HIGHLIGHT->process('
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Highlight</title>
  </head>
  <body>
    <!-- Content -->
  </body>
</html>
');

REGEX MODIFY

Here's a snippet of Syntaxo regex for comments on each language. And you can modify them as needed and get even better results.

// HTML
"/(&lt;\!\-\-[[:space:]]*.*[[:space:]]*\-\-&gt;)/isU" => '<span class="c">\\1</span>',
// JavaScript
"/(\/\/.*\n+)/isU" => '<span class="c">\\1</span>',
// CSS
"/(?<!\w)((\/\*\s*|\*\s*)([^\[|\#]*)(\*\/)?)/i" => '<span class="c">\\1</span>',

Preview

The index.php preview

Contribute

Please read the contributing.

Authors

prod3v3loper

Support

Hyperly

License

MIT