simple way to show a "source code" button? #1762
Replies: 4 comments 4 replies
-
This is all assuming the use of the MkDocs Material theme. CSS might need tweaking for other themes in MkDocs. [:octicons-file-code-24:][_inlinehilite]{: .source-link }
# InlineHilite Below is (I think) all the CSS needed. .md-typeset a.source-link{
position:relative;
top:-.6rem;
float:right;
color:var(--md-default-fg-color--lighter);
transition:color 125ms
}
.md-typeset a.source-link:hover{
color:var(--md-accent-fg-color)
}
.md-typeset a.source-link .twemoji{
height:1.2rem
}
.md-typeset a.source-link .twemoji svg{
width:1.2rem;
height:1.2rem
} |
Beta Was this translation helpful? Give feedback.
-
Thanks
And yes I definitely use MkDocs Material.
I don’t understand anything about css so I will blindly follow these instructions :)
…On Fri, Jul 22 2022 at 9:20 PM, Isaac Muse < ***@***.*** > wrote:
Oh, you should also be using the attr_list extension. MkDocs Material theme
utilizes the Emoji extension to create custom emojis. You may have to
manually inject the needed HTML if you aren't using MkDocs material. It's
basically just a link wrapped around a specially formatted image.
—
Reply to this email directly, view it on GitHub (
#1762 (reply in thread)
) , or unsubscribe (
https://github.com/notifications/unsubscribe-auth/AAEHK2ZX3ZE4OYILCKUE44DVVNCE3ANCNFSM54MAWX3Q
).
You are receiving this because you authored the thread. Message ID: <facelessuser/pymdown-extensions/repo-discussions/1762/comments/3210347
@ github. com>
|
Beta Was this translation helpful? Give feedback.
-
Thanks for all the details! Are these auto-generated for every source code file? For example your I should have been more clear what I was looking for. I am using this recipe in mkdocstrings to auto-generate doc pages (.md) files for every |
Beta Was this translation helpful? Give feedback.
-
Hacking the autodoc script to show source links (as regular text hyperlink, not icon) turned out to be easy. At some point I will try to get the icons using your suggestions. |
Beta Was this translation helpful? Give feedback.
-
Folks, I found a few issues/discussions but cannot get the hang of it. This is the end result I am looking for: Next to a function title (or class, method, etc) there should be a "github" link or "source code" button that takes you directly to the github repo location of that function. [Optional: Even better if there is a way to refer to a specific source code line in github, as part of a doc page. ].
Is this possible with mkdocs/mkdocstrings? if so could someone point me to an example?
I see that the docs of this repo itself have this feature: on the upper right of each doc page there is a source-link, as shown in the screenshot.
Would be great to know how to achieve this. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions