tempestphp / highlight Goto Github PK
View Code? Open in Web Editor NEW๐จ Fast, extensible, server-side code highlighting for web and terminal
Home Page: https://tempest.stitcher.io/highlight/01-getting-started
License: MIT License
๐จ Fast, extensible, server-side code highlighting for web and terminal
Home Page: https://tempest.stitcher.io/highlight/01-getting-started
License: MIT License
use Tempest\Highlight\IsPattern;
use Tempest\Highlight\Pattern;
use Tempest\Highlight\Tokens\TokenType;
final readonly class NamespacePattern implements Pattern
{
use IsPattern;
public function getPattern(): string
{
return 'namespace (?<match>[\w\\\\]+)';
}
public function getTokenType(): TokenType
{
return TokenType::TYPE;
}
}
For strings and numbers
I'll need to create a separate implementation for PHP and JS, since types are written differently.
Let's not color comments
Missing from the README is a list of supported languages.
Variable with -
trait Test {
abstract public function test(int $input): int;
}
To be injected within /** */
tags in PHP and JS
`{php}public sting $bar`
Will render public sting $bar
as PHP
So that {{ !!}
doesn't match
if (is_null($callback) && $abstract instanceof Closure) {
&&
is type)
is typestatic::$instance
static is typevalue instanceof Closure ? $value : fn () => $value)
?
is type{_highlight_}
{*higlhight*}
{~blur~}
<span class="hl-em">highlight</span>
<span class="hl-strong">highlight</span>
<span class="hl-blur">highlight</span>
(Foo&Bar)|null
The problem is with the brackets, which sometimes also match the function definition:
(Foo $bar
?
is type instead of keyword
extends is keyword
&&
is colored as a type
SQL is one of the core multi-discipline 4th generation programming languages.
I'd suggest SQL 92 as the base. Here are the keywords:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.