Add CSS for the Python handler of mkdocstrings#7
Conversation
Signed-off-by: pawamoy <dev@pawamoy.fr>
|
Some commits were not verified and/or signed off:
|
| } | ||
|
|
||
| .md-sidebar code.doc-symbol-type_parameter::after { | ||
| content: "T"; |
There was a problem hiding this comment.
note: Same as Type, but with different color. Not sure if we should use TP instead (makes me think of toilet paper...), and two letters would make a less round label 🤷
| } | ||
|
|
||
| .md-sidebar code.doc-symbol-method::after { | ||
| content: "M"; |
There was a problem hiding this comment.
note: Same as Module, but with a different color. Not sure if we should use more letters.
| } | ||
|
|
||
| .md-sidebar code.doc-symbol-module::after { | ||
| content: "M"; |
There was a problem hiding this comment.
note: Might use MOD to differentiate from methods, nor sure 🤷
| :root { | ||
| --md-admonition-icon--mkdocstrings-source: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.22 4.97a.75.75 0 0 1 1.06 0l6.5 6.5a.75.75 0 0 1 0 1.06l-6.5 6.5a.749.749 0 0 1-1.275-.326.75.75 0 0 1 .215-.734L21.19 12l-5.97-5.97a.75.75 0 0 1 0-1.06m-6.44 0a.75.75 0 0 1 0 1.06L2.81 12l5.97 5.97a.749.749 0 0 1-.326 1.275.75.75 0 0 1-.734-.215l-6.5-6.5a.75.75 0 0 1 0-1.06l6.5-6.5a.75.75 0 0 1 1.06 0"/></svg>') | ||
| } | ||
| .md-typeset .admonition.mkdocstrings-source, | ||
| .md-typeset details.mkdocstrings-source { | ||
| border: none; | ||
| padding: 0; | ||
| } | ||
| .md-typeset .admonition.mkdocstrings-source:focus-within, | ||
| .md-typeset details.mkdocstrings-source:focus-within { | ||
| box-shadow: none; | ||
| } | ||
| .md-typeset .mkdocstrings-source > .admonition-title, | ||
| .md-typeset .mkdocstrings-source > summary { | ||
| background-color: inherit; | ||
| } | ||
| .md-typeset .mkdocstrings-source > .admonition-title::before, | ||
| .md-typeset .mkdocstrings-source > summary::before { | ||
| background-color: var(--md-default-fg-color); | ||
| -webkit-mask-image: var(--md-admonition-icon--mkdocstrings-source); | ||
| mask-image: var(--md-admonition-icon--mkdocstrings-source); | ||
| } |
There was a problem hiding this comment.
issue: This "works" only with the classic theme and needs to be fixed in the modern one (very ugly currently). The goal is simply to make these "source code blocks" admonition visually less noisy.
| /* Indentation. */ | ||
| div.doc-contents:not(.first) { | ||
| padding-left: 25px; | ||
| border-left: .05rem solid var(--md-typeset-table-color); | ||
| } |
There was a problem hiding this comment.
note: This isn't part of the CSS for the classic theme. I wonder if we should add it by default to the modern one. Not all users of mkdocstrings set this in their projects (maybe because they simply didn't know they could).
| /* Mark external links as such. */ | ||
| a.external::after, | ||
| a.autorefs-external::after { | ||
| /* https://primer.style/octicons/arrow-up-right-24 */ | ||
| mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>'); | ||
| -webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>'); | ||
| content: ' '; | ||
|
|
||
| display: inline-block; | ||
| vertical-align: middle; | ||
| position: relative; | ||
|
|
||
| height: 1em; | ||
| width: 1em; | ||
| background-color: currentColor; | ||
| } | ||
|
|
||
| a.external:hover::after, | ||
| a.autorefs-external:hover::after { | ||
| background-color: var(--md-accent-fg-color); | ||
| } No newline at end of file |
There was a problem hiding this comment.
note: This isn't part of the CSS for the classic theme. After a query on https://grep.app/ it looks like most projects did set this manually, by literally copying it from my own recommendations, so I assume it's a good idea to provide this by default.
No description provided.