Files
FixIt/assets/css/_shortcodes/_file-tree.scss
T
Cell fdfd772100 feat(File Tree): add file-tree shortcode support (#685)
* feat(File Tree): add `file-tree` shortcode support

* feat(file-tree): add ignoreList parameter to file-tree shortcode

* feat(file-tree): enhance file-tree shortcode with ignoreList and folderSlash options

* feat(file-tree): enhance file-tree shortcode to support data mode

* feat(file-tree): enhance file-tree shortcode to support file mode

* feat(file-tree): improve content parsing in file-tree shortcode

* feat(file-tree): improve root path validation and error handling in filesystem mode

* test(file-tree): add unit tests for `file-tree` shortcode

* feat(file-tree): add file-tree code block rendering support

* refactor(file-tree): extract filesystem scanning to get-file-tree partial

Move directory traversal and root path validation to a separate partial function,
consolidating all filesystem-related logic in one place. This simplifies the
shortcode implementation and ensures a unified data format for rendering.

* docs(readme): extend code fence and shortcode support for file tree in documentation

* feat(file-tree): add fullRootName parameter for root path display in file tree

* feat(file-tree): add language parameter to get-file-tree function

* feat(file-tree): add highlightList parameter for file-tree shortcode

* perf(file-tree): add level param for get-file-tree function to descend only level directories deep
2026-01-14 16:01:22 +08:00

110 lines
2.2 KiB
SCSS

.file-tree-wrapper {
border: 1px solid var(#{$rootPrefix}global-border-color);
padding: 0.5rem;
font-size: 0.8rem;
line-height: 1;
margin-block: 0.5rem;
@include border-radius($global-border-radius);
@include transition(box-shadow 0.2s ease);
&:hover {
@include box-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
[data-theme='dark'] & {
@include box-shadow(0 2px 8px rgba(255, 255, 255, 0.1));
}
}
ul.file-tree {
list-style: none;
margin: 0;
padding: 0;
.file-tree-item {
position: relative;
&.file-tree-folder {
> .file-tree-toggle {
cursor: pointer;
font-weight: bold;
[data-theme='dark'] & {
color: #ddd;
}
&:hover {
i,
span {
opacity: 0.6;
}
}
}
}
.file-tree-label {
display: inline-flex;
align-items: center;
position: relative;
gap: 0.25rem;
padding: 0.25rem 0.5rem;
@include border-radius($global-border-radius);
@include transition(all 0.15s ease);
.file-tree-icon {
width: 1rem;
text-align: center;
flex-shrink: 0;
}
&.is-highlighted {
color: var(#{$rootPrefix}global-link-hover-color);
}
}
}
&:not([data-level='0']) {
.file-tree-item {
margin: 0.25rem 0;
padding-left: 0.25rem;
.file-tree-label::before {
content: "";
position: absolute;
top: 50%;
left: -0.5rem;
translate: 0 -50%;
width: 0.75rem;
height: 1px;
background-color: var(#{$rootPrefix}secondary);
}
}
}
}
.file-tree .file-tree {
padding-left: 1.25rem;
position: relative;
&::before {
content: "";
position: absolute;
top: -0.25rem;
bottom: 0.625rem;
left: calc(1rem - 0.5px);
width: 1px;
background-color: var(#{$rootPrefix}secondary);
height: var(#{$rootPrefix}file-tree-line-height);
}
}
.file-tree-item.is-collapsed {
> .file-tree {
display: none;
}
> .file-tree-label .file-tree-icon::before {
content: '\f07b';
}
}
}