-
-
Notifications
You must be signed in to change notification settings - Fork 274
feat: page hierarchy overview #1449
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
base: main
Are you sure you want to change the base?
feat: page hierarchy overview #1449
Conversation
Changed |
|
||
if #hierarchyItems > 0 then | ||
-- HTML instead of Markdown to make it collapsible | ||
local html = "<div class=\"collapsible-hierarchy collapsed\">" .. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't the multiline string syntax be better suited here? [[ ... ]]
|
||
// Toggle function for collapsible hierarchy | ||
// @ts-ignore: on purpose | ||
globalThis.sbWidgets.toggleHierarchy = function(header: HTMLElement) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a little misplaced imo. This could just be in the widget code as a script tag, couldn't it?
if (html) { | ||
|
||
// Combine HTML from both sources: Markdown and HTML | ||
if (htmlFromHtml || htmlFromMarkdown) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like weird behaviour to me, it's not intuitive.
Imo, if the user decides he wants to export raw html, but still include markdown they should use the markdownToHtml
syscall. 90% of the time just concatenating it in a div is not going to be what you want.
@@ -159,3 +159,63 @@ body { | |||
.sb-markdown-toolbar:hover { | |||
opacity: 1; | |||
} | |||
|
|||
/* Collapsible hierarchy widget styles */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be put into a style tag in the lua. Imo, keeping as much out of SB itself is the main objective
@@ -302,3 +302,9 @@ html[data-theme="dark"] { | |||
--admonition-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>'); | |||
--admonition-color: #ff9100; | |||
} | |||
|
|||
/* Chevron icons for collapsible sections */ | |||
html { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the other comments
Added my 2 cents |
I'm wondering if this should be included in the standard library or if it can just be a script to be shared on community.silverbullet.md. If it gets popular, we can include it in the standard distribution. |
Hello, this PR adds a bottom widget (after Linked Mentions) to display page hierarchy, if the current page is part of it. It always shows the immediate parent and any children for easy navigation, with each page being clickable individually.
Note Collapsible is the same as for #1439, breadcrumbs as for #1448