Hi!
Just sharing some CSS I wrote to create a callout suited to represent file/folder structures. For example:
This has been obtained with the following Markdown, where the folder structure is just implemented through a list within a folder
callout:
> [!folder] folder
> - π Folder *` `β root folder*
> - π Item 1 *` `β some item in the folder*
> - π Subfolder 1 *` `β another folder*
> - π Subitem 1-1
> - π Subitem 1-2
> - π Subfolder 2
> - π Subitem 2-1
> - π Subitem 2-2
> - π Subsubfolder
> - π ==Name==.jpg *` `β¦ Some variable name?*
> - β¦
In the above example, youβll find that emphasis (*β¦*
) is used to add comments/explanations, inline code (`β¦`
) is used within said comments for space control, and highlights (==β¦==
) is used for variable names.
Hereβs the CSS:
.callout[data-callout=folder i] {
--list-indent: 0em;
--indentation-guide-color: transparent;
overflow: scroll;
}
.callout[data-callout=folder i] .list-bullet {
display: none;
}
.callout[data-callout=folder i] ul {
-webkit-margin-after: 0;
margin-block-end: 0;
}
.callout[data-callout=folder i] li {
--list-indent: 1.5em;
list-style-type: none;
font-family: var(--font-monospace);
white-space: nowrap;
}
.callout[data-callout=folder i] li li {
position: relative;
box-sizing: border-box;
}
.callout[data-callout=folder i] li li::before,
.callout[data-callout=folder i] li li::after {
content: "";
position: absolute;
left: -1em;
background: var(--list-marker-color);
}
.callout[data-callout=folder i] li li::before {
top: 0.85em;
width: 10px;
height: 1.5px;
margin: auto;
}
.callout[data-callout=folder i] li li::after {
top: 0;
bottom: 0;
width: 1.5px;
height: 100%;
}
.callout[data-callout=folder i] li li:last-child::after {
height: 0.85em;
}
.callout[data-callout=folder i] li .list-collapse-indicator {
position: absolute;
left: -2em;
margin: 0;
}
.callout[data-callout=folder i] li em {
opacity: 0.5;
font-family: var(--font-text);
}
.callout[data-callout=folder i] li code {
font-size: 1em;
font-family: var(--font-monospace);
font-style: normal !important;
background: none;
white-space: pre;
margin: 0;
padding: 0;
}
.callout[data-callout=folder i] li mark {
font-style: italic;
color: #d3a3e5;
}
.callout[data-callout=folder i] .callout-content {
overflow-x: visible;
}