-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Footer “edit me” link #56
Comments
I was imagining the page generator (parseMarkdown?) would have access to the |
related #739 |
Here's my take on this, in observablehq.config.js: const SOURCE_REPO = "https://github.com/USER/PROJECT/blob/main/docs";
const VIEW_SOURCE = `
<style>
a.view-source {
position: absolute;
top: 0;
right: 0;
font: 700 18px var(--sans-serif);
text-decoration: none !important;
padding: 0 4px;
}
a.view-source:not(:hover,:focus) {
color: inherit;
}
</style>
<a class="view-source" target="_blank" aria-label="view source" title="view source" href="${SOURCE_REPO}">⚉</a>
<script type="module">
const a = document.querySelector(".view-source");
a.setAttribute("href", a.getAttribute("href") + (document.location.pathname.replace(/[/]$/, "/index")) + ".md?plain=1"
);
</script>
`;
export default {
header: ${VIEW_SOURCE}
}; |
Would be nice to support non-GitHub hosted (but still open source) websites! |
I think we have enough possibilities now for a user to add their own links in header or footer. It could be nice to support passing these options as functions that would receive a bit of context (page name, page url)? |
If a project is hosted on GitHub (or other hosting service), it’d be nice if we could automatically generate an “edit me” link in the footer.
The text was updated successfully, but these errors were encountered: