Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax Highlighting #99

Open
pablrod opened this issue May 24, 2015 · 2 comments
Open

Syntax Highlighting #99

pablrod opened this issue May 24, 2015 · 2 comments

Comments

@pablrod
Copy link

pablrod commented May 24, 2015

I can help adding syntax highlighting to hdb.

I already did a small attempt using highlight.js: pablrod@00a3dc1 But it need some work to get a good pull request (Solve CSS "dirty tricks" and remove CDN use).

If you think is a good idea, just let me know.

@brummett
Copy link
Owner

If you can get it working, I'd consider merging it in.

Javascript libs have just been dumped in lib/Devel/hdb/html/. For example, handlebars and jquery are already there. Whatever highlighting is used, it need to be readable even with the blue background of the current line, which it seems to,

Some complications you might need to be aware of. hdb parses the Perl code lines looking for things that look variable-like to support hovering the mouse over a variable to see its value. Simple vars like $a and @a get wrapped in a span. More complicated expressions like $a{b}, $a[2] and $a[$b] get wrapped in a couple of spans - if you mouse over the front part "$a", it'll show the whole hash, while mousing over the last part "{b}" just shows the value for that element. I tried your branch out on some simple expressions like those and it looks OK.

I also noticed that the highlighter does something with the line numbers on the left side of the code windows: some of them are green and some are black. Multiline strings also aren't highlighted properly. Both of these are probably because of how hdb breaks up each code line into its own div.

@pablrod
Copy link
Author

pablrod commented Jun 2, 2015

The Javascript lib highlight.js is now in lib/Devel/hdb/html.
The issue with line numbers is also fixed, and hovering support is working.

pablrod@6f04cc4

But I'm still resolving the issue with multi line strings (and also here-docs)

Thanks for your comments and for pointing out multi line strings problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants