Comments (7)
First of all happy new year! And second sorry that I chime in here. Regarding your issue addcslashes($value, '/') is your friend. It escapes all slashes, if not already done. The string can then be safely used in a regex :-D.
Oh no, welcome and happy new year! As s1syphos said, we're happy to have people around. Using addcslashes
seems promising and worth a try.
Another minor issue and only if you are interested in. I'd like to see this library more memory friendly. Currently, it loads all languages into memory. IMO this shouldn't be. In the first stage, only the language names and their aliases are needed. Loading the respective language rules should be done dynamically upon request. What do you think?
I've experimented with lazy loading languages in the Highlighter before, but the time difference was surprisingly negligible. However, I didn't check the memory differences so I'd be open to revisiting it and adding lazy loading for memory improvements.
Are you two the new maintainers of the project?
Yup, that's us!
And do already have plans for this project?
Nothing really laid out but we're open to suggestions. I've just slowly been reorganizing/cleaning things up a tad.
from highlight.php.
from highlight.php.
Merry Christmas! 😄
from highlight.php.
First of all happy new year! And second sorry that I chime in here. Regarding your issue addcslashes($value, '/')
is your friend. It escapes all slashes, if not already done. The string can then be safely used in a regex :-D.
Another minor issue and only if you are interested in. I'd like to see this library more memory friendly. Currently, it loads all languages into memory. IMO this shouldn't be. In the first stage, only the language names and their aliases are needed. Loading the respective language rules should be done dynamically upon request. What do you think?
Kind regards,
Benny
from highlight.php.
Thanks for the suggestion, and also your kind words. As you can see (especially throughout this issue), we are damn happy people around here - even more so if a PR comes our way 👍
from highlight.php.
Oh, great! 😄 Are you two the new maintainers of the project? And do already have plans for this project?
from highlight.php.
Alright and thanks for the friendly welcome 😄
I've experimented with lazy loading languages in the Highlighter before, but the time difference was surprisingly negligible. However, I didn't check the memory differences so I'd be open to revisiting it and adding lazy loading for memory improvements.
Yes, the time differences are negligible, but it is possible to save ~10 MB of memory. A huge difference and the payload of the Highlighter is then even smaller at around 1-2 MB. Please have a look at my PR #16.
My PR also addresses this issue here, reformat the code, adds doc blocks and sticks to modern coding conventions. I hope there is no issue with that and you guys are willing to merge it.
from highlight.php.
Related Issues (20)
- [PHP] Highlighting `new` keyword HOT 3
- Theme Rendering Inconsistency on PHP codes
- php comments HOT 6
- Not highlighting correctly
- CSS does not highlight nested `var()`
- Display more than 1 code block HOT 1
- Adding demo images/live demo/compiled HTML demo?
- Any Plan to Convert {language}.json to {language}.php? HOT 3
- Freezing issue with coffeescript regex under some circumstances HOT 20
- Potential fixes for failing tests/skipped unit tests
- Demo took a long time to run & Normal chatacters Rander HOT 8
- Where is highlight.php v10.x/v11.x? HOT 26
- PHP Template Language Missing HOT 3
- Performance issue HOT 14
- Highlighter duplicating Russian characters (unicode) HOT 12
- script tag not highlighted HOT 2
- PHP 8.1 deprecation messages HOT 2
- C# - Missing keywords
- PHP code seems to be insufficiently tagged.
- Dynamic properties are deprecated in PHP 8.2 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from highlight.php.