Giter Site home page Giter Site logo

Comments (7)

allejo avatar allejo commented on August 16, 2024 2

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.

S1SYPHOS avatar S1SYPHOS commented on August 16, 2024

from highlight.php.

allejo avatar allejo commented on August 16, 2024

Merry Christmas! 😄

from highlight.php.

Sommerregen avatar Sommerregen commented on August 16, 2024

Hi @allejo and @S1SYPHOS ,

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.

S1SYPHOS avatar S1SYPHOS commented on August 16, 2024

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.

Sommerregen avatar Sommerregen commented on August 16, 2024

Oh, great! 😄 Are you two the new maintainers of the project? And do already have plans for this project?

from highlight.php.

Sommerregen avatar Sommerregen commented on August 16, 2024

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)

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.