
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Generate plain css tree structure.
Add this line to your application's Gemfile:
gem 'tree_html'
And then execute:
$ bundle
Or install it yourself as:
$ gem install tree_html
In Node class, include TreeHtml
.
Then implement label_for_tree_html
and children_for_tree_html
for Branch class, and label_for_tree_html
for Leaf class.
Finally, call tree_html
on node object to get ul/li fragment, or tree_html_full
to get a html file with pre-defined style.
By Default, any object can be leaf, and renders as to_s
.
You may overwrite data_for_tree_html
, head_js_for_tree_html
, body_js_for_tree_html
, css_for_tree_html
to specify your own style.
In generated html, hover a branch and
f
/u
to fold/unfold it's childrenp
/n
to jump to it's previous/next sibling brancha
to print ascii tree in consoleYou may change these function keys in body_js_for_tree_html
.
Or checkout test/tree_html_test.rb to see how to use.
You may register more handlers for responsing key press. For example, to do something when hovering on any li
and pressing r
TreeHtml.hover_press('r', function(li){
// actions
})
You may also group li
s with same key under additional ul
:
var switch = TreeHtmlGroup({
name: 'by_whatever_key',
key: function get_path(li) {
var p = li.querySelector('a').innerText.replace(/* key calculation here */)
return '<b>' + p + '</b>'
}
})
switch('by_whatever_key')
switch('') // switch back
FAQs
Unknown package
We found that tree_html demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.