CSS for inline block references that works for both NEW CM6 Live Preview and als...
source link: https://gist.github.com/GitMurf/46c9ae78d6c3ce53d42d7832c7601271
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Author
GitMurf commented on Nov 11, 2021
Here is link to the original Preview Mode CSS for inline block references: https://gist.github.com/GitMurf/bb68e9f48556b80d9a694eb0fd1742fe
Author
GitMurf commented on Nov 16, 2021
This is fantastic, what a joy to see/not see those block references like that.
I have a related question: I have a number of old references to headers (I try to avoid those now), which means all the text below the headers down to the next header is shown in the transclusion. In Live Preview that transclusion is out of line vertically with the host text, has a rim around it, a scrollbar, a link icon, and big gaps above and below. This is how I cope with that:
/* eliminate scrollbars, borders, and vertically align */
.markdown-embed, .markdown-embed-content.node-insert-event { /* CM6; the above is CM5 */
max-height: unset;
border: none !important;
margin-left: -1.2rem !important; /* for Live Preview; in Preview: -0.5rem */
margin-bottom: -2rem !important;
margin-top: 0rem !important;
}
/* hide link icon */
.markdown-embed-link svg {
opacity: 0;
}
/* show link icon on hover */
.markdown-embed:hover svg {
opacity: 1;
}
The margin-left
interferes with your code, so I commented it out. Is there a way to fix the vertical misalignment in any other way without it affecting your code?
Author
GitMurf commented on Nov 20, 2021
@DutchPete the following should work. The key is adding span:not([src*="^"]) >
in front of the .markdown-embed
selector.
span:not([src*="^"]) > .markdown-embed, span:not([src*="^"]) > .markdown-embed .markdown-embed-content.node-insert-event { /* CM6; the above is CM5 */
max-height: unset;
border: none !important;
margin-left: -1.2rem !important; /* for Live Preview; in Preview: -0.5rem */
margin-bottom: -2rem !important;
margin-top: 0rem !important;
}
/* hide link icon */
span:not([src*="^"]) > .markdown-embed .markdown-embed-link svg {
opacity: 0;
}
/* show link icon on hover */
span:not([src*="^"]) > .markdown-embed:hover svg {
opacity: 1;
}
tctco commented on Dec 25, 2021 •
that0n3guy commented on Jan 4
I came up with a way that can keep my standard inline block referencing as default including hiding the new children list item / bullet feature (will hide the children).... but then ALSO allow for you to have a regular embed to bring in children list items if you want by simply adding |children
as an alias to the block ref embed link (see screenshot).
Hello! Thanks very much for a great snippet - this is doing exactly what I wanted! The only issue I'm currently coming across is what I've included a screen shot of.
On line 1, I have a task that's been written into this document. Line 2 is an embed task from another document, but the information in that embedded line has its own new line constraints. You can see that line 3, which contains another local task, extends past the embed in line 2.
Is there any way to adjust the width of the embedded item? Thanks!
@jjesskalee can you please try without any theme? I believe this is a theme issue or another css snippet because I don’t have this problem with vanilla default theme.
Hi great CSS code that add great feature to the app.
I need your help with this (and please bear with me bc I'm a noob). I've spend a whole day messing around and even with your detailed annotation in the code I still can't do what I want:
This is currently my set up in Logseq. There are 2 things that I like:
- Block reference are inline, no matter if it's a reference within another reference. (I make text brown so that I know it's a block ref).
- I have a "^" at the end of block ref to indicate that it's a block ref. This helps me to know that there is a block ref within a block ref.
- In Obsidian, block ref within block ref breaks line in Preview Mode (but not Reading Mode) -> Please help make the line not broken if I have block ref within block ref.
- I can't seem to add "^" at the end of the block ref using the syntax I have in Logseq even when I was able to identify the block ref in Obsidian (using Ctrl Shift I) and was able to change the color of the block ref. Please help me add "^" at the end of the block ref.
This is what I meant
In reading mode: Line is not broken
In Preview mode line is broken
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK