Royi
November 24, 2023, 2:23pm
1
I have a note with many MathJaX macros called MathJaXMacros.md
:
$$
\DeclareMathOperator{\sign}{sign}
\DeclareMathOperator{\prox}{prox}
\DeclareMathOperator{\rank}{rank}
\newcommand{\MyParen}[1]{\left( #1 \right)}
\newcommand{\MyBrack}[1]{\left\lbrack #1 \right\rbrack}
\newcommand{\MyBrace}[1]{\left\lbrace #1 \right\rbrace}
\newcommand{\MyMat}[1]{\begin{bmatrix} #1 \end{bmatrix}}
\newcommand{\MyNorm}[2]{{\left\| #1 \right\|}_{#2}}
\newcommand{\MyAbs}[1]{\left| #1 \right|}
\newcommand{\MyNormTwo}[1]{\MyNorm{#1}{2}}
\newcommand{\MyCeil}[1]{\lceil #1 \rceil}
\newcommand{\MyInProd}[2]{\langle #1, #2 \rangle}
\newcommand{\MyUndBrace}[2]{\underset{#2}{\underbrace{#1}}}
\newcommand{\RR}[1]{\mathds{R}^{#1}}
\newcommand{\BS}[1]{\boldsymbol{#1}}
\newcommand{\MyClr}[2]{{\color{#1}{#2}}}
$$
I want to embed is in other notes I have which use MathJaX.
I am adding to them something like ![[MathJaXMacros#^c8c481]]
.
It works functional wise.
Yet, the embedding note will have something like:
Is there a way to prevent it?
Namely, embed the note without any link shown on the embedding note.
Something like hidden embedding for such cases.
woofy31
November 24, 2023, 2:32pm
2
Yup, it’s possible by using a CSS snippet, as follows:
/* hide the right-side link icon */
.markdown-embed-link >.svg-icon.lucide-link {
display: none;
}
/* hide the left-side border */
.markdown-embed {
border-left: none;
}
1 Like
ush
November 24, 2023, 2:44pm
3
Not answering the original question, but I think this is what you’re looking for
With this plugin, you will not need to embed MathJaxMacros.md in every note you create. Plus, it doesn’t affect how your notes look.
1 Like
Royi
November 24, 2023, 8:41pm
4
OK, Can I make it specific to some links and not global?
woofy31
November 24, 2023, 8:54pm
5
Yup, as follows:
/* hide EMBEDDED link markers */
.markdown-embed[src*="Untitled"] .markdown-embed-link svg {
display: none;
}
/* hide EMBEDDED border */
.markdown-embed[src*="Untitled"] {
border-left: none;
}
where you replace Untitled
with your desired part of the note title (or even the whole note title if you want) that you want this to apply to.
2 Likes
Royi
November 24, 2023, 9:50pm
6
I see.
So if I want to embed from a note called MathJaXMacros
I should replace "Untitled"
with "MathJaXMacros"
. Right?
Where do I put this CSS snippet?
1 Like
woofy31
November 24, 2023, 9:52pm
7
That is correct.
Have a read on the Obsidian documentation here:
2 Likes
Royi
November 25, 2023, 7:50am
8
I created a .css
file and Obsidian loads it as a CSS snippet.
It works!
It still creates excessive top and bottom margins, but no link icon or left border.
I thought about something else, can I, using the CSS, embed the MathJaX SVG in this container?
https://www.mathjax.org/badge/mj-logo.svg
1 Like
woofy31
November 25, 2023, 9:27am
9
OK, so I’ve refactored the whole CSS snippet to remove leftside spacing as well, and to insert your custom SVG instead of the default link on the right side (any top/bottom margins you see are either from your theme or plugins, because on my end I don’t have any margins) . Result:
The new CSS snippet:
.markdown-embed[src*="MathJaXMacros"] {
/* remove left border & spacing */
border-left: none;
padding: 0;
margin: 0;
& .markdown-embed-link {
/* make sure custom SVG is fully opaque */
opacity: 1;
/* hide default link icon */
& svg {
display: none;
}
/* insert custom SVG instead */
&::after {
content: url(https://www.mathjax.org/badge/mj-logo.svg);
display: block;
width: 100px;
}
}
}
2 Likes
ariehen
November 25, 2023, 9:37am
10
Alother option is using alt / attribute text so the CSS isn’t bound to the note name.
.internal-embed[alt*="cleanish"],
.internal-embed[alt*="cleanish"] svg {
border-left: none;
display: none;
}
And you’d write the link as ![[MathJaXMacros#^c8c481|cleanish]]
Either way, you’ll need to manually change something (in the CSS for the file name if you rename it, or in the attribute text) if you want the no left border and no link icon for only certain embeds.
If you want a no left border and no icon for all embeds, that’s easy.
2 Likes
system
Closed
December 2, 2023, 9:38am
11
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.