-
Notifications
You must be signed in to change notification settings - Fork 158
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
Modernize the default theme #849
Comments
I think it's a great idea! |
I started working on this in branch modern-theme. All very much WIP. |
Example of how this could look like with some basic theming: Custom CSS on Telplin side: @import url('https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,400;1,300&display=swap');
:root {
--primary: #ffdd59;
--secondary: #6d7276;
--background: #fdfdfd;
--header-background: var(--primary);
--system-font: 'Raleway', sans-serif;
--header-brand-text-transform: capitalize;
--aside-width:270px;
--code-background: rgba(210, 222, 222, 0.15);
}
[data-theme=dark] {
--header-background: var(--secondary);
--background: #38393a;
--menu-item-hover-background: #38393a;
} |
One other thing I currently find a bit lacking is the ability to insert a custom script in the head or body of the default template. I find myself often adding one extra script or creating a web component to later use in a Markdown file. This in itself isn't really a strong or compelling reason to start creating a custom template file. Perhaps we can introduce additional placeholder replacements. Similar to how |
I've pushed a new feature where you can create a Would there be interest in a community call about the progress so far? |
Some customization of head/body seems nice. Does I'd like to be able to add automatic download links to each page. To do that, I'd want the below snippet immediately before [![Notebook](img/badge-notebook.svg)]({{root}}/{{fsdocs-source-basename}}.ipynb) The head option is also nice because Plotly.NET graphs ideally have a plotly script in a page header (see plotly/Plotly.NET#373) and I prefer to use the custom template. |
Right now it goes at the end before the closing tag in both cases. But people could change this behaviour when they roll their own The scenario for automatic download links to each page would work fine in both |
Ah ok, I thought we were using https://github.com/ionide/KeepAChangelog for that but it appears not.
Yes, we can definitely revisit the coding colours. I'm personally not used to dark mode so I struggle there from time to time. Thanks for testing in firefox/opera/edge. So far I've only used Chrome.
Yes, search is still on the todo list. It does absolutely nothing right now. As for the navigation: Right now the HTML of the navigation is coming from the transformed
This would require a change in the frontmatter itself. Otherwise, the user has no way of specifying that title.
Yes, a fine suggestion but the current information is not present in the generated HTML for this.
I would consider that out of scope as well. I'm open to the idea thought. Do you have any examples where that works nicely? @Freymaurer many thanks for this feedback! Apologies if I seem unreceptive to some of your ideas; you've pinpointed some of the current tool's weaknesses accurately 😅. |
I saw you were using lit-webcomponents already and i have actually done something similiar with lit here. Altough this component also reactively updates to scroll position and headers on the page, so a implementation only reflecting the actual url should be way less complex. (Please excuse my ts code 😅 ) |
These are great examples, thank you! It really is worth having this. |
Regarding in-page navigation, I think the pytorch docs are pretty good. But overall, it's probably out of scope. It goes from a style change to a wholesale revamp.
I think we have it in the heading info from the markdown model. The DSL accounts for different heading levels. The pandoc markdown tool uses that info to generate tables of contents (toc) from section headings. Examples here, specifically demo 2 without toc versus demo 3 with toc, custom css, and custom footer. |
Yes, we have it but it would require some new transformation to HTML and have a new substitution parameter. Something I think we want to do a bit later maybe. |
Another thing that has been on my wish-list for some time is a button that says "Improve this page" and it opens the edit mode of a GitHub page. Again, I'm not sure if we have the information to construct the right URL and not every project is no GitHub but for a lot of folks, this would be nice to have I think. |
@Freymaurer I was able to add a CSS class to the currently active menu item. |
Nice! Can you show me where you implemented this? |
Everything is still happening in the modern theme branch. |
I added the "On this page" section. Very happy with the result, a little less with how I got there. I will publish the first alpha of this tomorrow. I'm at the stage where I changed a lot of things and no longer can say whether this will still work in every situation. |
oh wow, this is shaping up really nice! |
You can play with this using https://www.nuget.org/packages/fsdocs-tool/20.0.0-alpha-001 Be aware that there are gaps. Let me know how things are going. |
Live example: https://ionide.io/FSharp.Analyzers.SDK/ |
Looks very nice 👍 One minor thing. In darkmode contrast on "active page" is rather low, maybe adjust the colors a bit |
I was able to achieve that in IcedTasks: <div class="float-right" id="edit-this-page"><span><a class="nav-link"
href="{{fsdocs-package-project-url}}edit/{{fsdocs-repository-branch}}/docsSrc/{{fsdocs-source-filename}}"><i
class="fa-regular fa-pen-to-square pe-2"></i>Edit this page</a></span></div> |
The tooltips with modern theme are running off the page. I think the old tooltips were left-aligned with the token the tooltip was for. Maybe the tooltip is now center aligned? See when I hover over |
There is some new code to place the tooltip on the top when it can't fit on the rest of the screen. |
Regarding better search, I investigated pkgdown (=
So once again, Algolia is the industry standard. But personally, I like a simple, zero-config search option as the default. |
Yes, for v20 we should incorporate something like |
Good catch, that was indeed not working yet. Released https://www.nuget.org/packages/fsdocs-tool/20.0.0-alpha-005 20.0.0-alpha-005 - 2023-11-09Changed
Fixed
|
Released https://www.nuget.org/packages/fsdocs-tool/20.0.0-alpha-006 20.0.0-alpha-006 - 2023-11-09Added
This version has a basic search. I tweaked things a bit on this indexer side. |
It's really looking good @nojaf. I like a lot of what's new, but one thing I don't like is the new blockquote style. To me it looks like code rather than text. I'd prefer that the style was closer to normal text style, but maybe it's just me. I pushed a test site at this link with different block quote styles. The styles are identified with reaction emojis so people can vote by reacting to this post with the relevant emoji. My preference is something similar to 😕. |
I would go for |
the nits for me so far: the dark background for code samples is too bright / gives poor contrast for reading the code, and maybe the plain background out of code samples, a bit too dark. suggested code coloring tweaks in dark theme: --code-background: #28282D;
--code-function2-color: #cbda9d;
--code-value-color: #ffb4e9;
--code-reference-color: #40fddd;
--code-strings-color: #86b4b9;
--code-comment-color: #84d16e; which looks like this (https://ionide.io/FSharp.Analyzers.SDK/content/Getting%20Started%20Writing.html): Might be worth, in context of this repository, to have a F# code sample that lights up all colors the F# semantic analysis supports, and with some fable/js magic, a theme picker, we can then consider supporting shipping color schemes for code. edit: the overall make-up is stellar, it incentivizes me to look at updating some repository to fsdocs of today. |
Released 20.0.0-alpha-010 - 2023-11-15Fixed
This is the version I used to tweak https://fsprojects.github.io/fantomas/docs/. |
Intro
The default CSS theme is getting out of date with today's web standards.
(It for example still contains wonderful things like
<!--[if lt IE 9]>
).And I believe it is time for a facelift.
In #844, I started by updating Bootstrap but I have doubts we still really need it as a dependency. The world of CSS is a brighter one these days. Flexbox and grids make positioning convenient, variables and even selector nested are a thing now.
I'm quite confident that we can create a modern stylesheet from scratch that is highly customizable using CSS variables.
Technical
I envision that we revisit
_template.html
completely:Yet I wouldn't change much of the generated HTML (for the API documentation pages) to start with.
Bet more on:
type="module"
and ESM import)I don't want to introduce any
Node/Deno/Bun
like tooling. These are wonderful things but we should stick to modern standards that don't require (any/many) building steps. We want to keep the entry barrier for contributors as low as possible. Having installed only the dotnet SDK should be enough to make some changes.The theme itself
I wouldn't overly do anything drastic or reinvent the wheel for the theme itself.
We could look at some other documentation sites for reference but I envision something rather basic with a top menu bar, a side menu bar and the page content. Something close to what existing users would expect.
Search
I do notice that search only really works for the API reference pages and also wish to modernize that part.
It is quite common to see searches being handled by third-party solutions like https://www.algolia.com/. These typically have a generous free tier and work really well.
Approach
We probably want to create a separate branch to develop this and publish alphas for people to try out.
At the very least we should ensure:
are well tested.
I've already talked about this topic during the F# for Data Science conference in Berlin with @nhirschey, @kMutagene and @Freymaurer. I'm confident we can make something work here.
And I would be happy to hear your thoughts on this.
The text was updated successfully, but these errors were encountered: