You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+5-1
Original file line number
Diff line number
Diff line change
@@ -169,7 +169,10 @@ tree = ascii_tree.renderable_from_parents(
169
169
)
170
170
print(ascii_tree.render(tree[0]))
171
171
```
172
-
Root-level nodes in your hierarchy *must* return `None` from either `parent_attr` or `parent_method`.
172
+
By default, nodes are considered to be "root-level" if they return `None` from either `parent_attr` or `parent_method`.
173
+
174
+
If your system handles root status differently, you can pass in a callback function,
175
+
`is_root_callback`, to `renderable_from_parents` to override this behavior. `is_root_callback` takes a single argument, the node in question, and should return `True` if the node is a root node, and `False` otherwise.
173
176
174
177
Note that `renderable_from_parents` always **returns a list** -- this is to ensure that
175
178
data with multiple root nodes are supported.
@@ -180,6 +183,7 @@ root
180
183
└─ child
181
184
└─ grandchild
182
185
```
186
+
183
187
## Rendering Styles
184
188
185
189
`ascii-tree` currently provides three styles of rendering:
0 commit comments