Closed jhildenbiddle closed 4 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
docsify-preview | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jul 18, 2024 8:40pm |
@jhildenbiddle bravo!
❤️
Btw, what does the search options stands for?
The goal was to allow end users to position the search field where they want in the sidebar. For example, here is the default first position (appended to sidebar as first child):
Here is how the search bar renders with insertAfter: '.app-name'
:
Positioning the search field below the app name is the layout I used in docsify-themeable. I wanted to replicate the layout as an option. Providing both insertAfter
and insertBefore
options ensures that search field can be positioned when elements are not rendered (like the app name/logo) or unknown sidebar content has been added by a plugin (like an ad).
I am open to renaming the option(s). Perhaps I can reduce it down to one option named something like sidebarOrder
or insertOrder
that accepts a number with 1 (default) meaning first child, 2 meaning immediately after the first sidebar element (likely the app name), etc.? Remember, we have to account for thing like the app name not being rendered (it's optional, so we can't use something like insertAfterName
) and for unknown sidebar content (like the ads we show on docsify.js.org).
Regarding moving the search field to other locations, we can do it but I'd prefer to handle that as a separate enhancement (which I assume would be a low priority issue). To be honest, I think the current search design works well with the layout we have. If/when we ever revisit the Docsify layout (v6?), I think that would be a better time to explore new search designs as well.
Let me know if anyone has a preference on renaming the search plugin's new insertAfter
and insertBefore
options. Thx!
Regarding moving the search field to other locations, we can do it but I'd prefer to handle that as a separate enhancement (which I assume would be a low priority issue).
Never mind.
I didn't mean we need do the search place enhancement, I meant if we have the functions, the place config
could make more sense to me. Put this enhancement in v6 or future all be fine.
The goal was to allow end users to position the search field where they want in the sidebar. For example, here is the default first position (appended to sidebar as first child):
As I mentioned, I understand the scenario, but... I only see this when I raise the question.
Personally, I think it is no much places to go besides the top, although we could put it either up or down to the .app-name.
After your clarify details, I know there may have other situation:
target
to us such as .app-name
to mount the search box. It sounds to solve where to mount
the search box on, and also it includes the relation problems to the target dom (before/after/ other?).
Currently, the insertAfter
and insertBefore
is straightforward to me and I think we can use it for now.
Additional assumption is providing a single mountOn
config in further, which support text
, css selector
, search DOM consumer
option such as other mixed Type options and we parse the option to decide how to resolve it.
Possible cases:
For default options with our default render result.
' '
pure default as appName
.appName
before the appNamesidebarNav
after the appNameCustomizer
css selector
[before] .app-name
same to current insertBefore
[after] #foo
same to current insertAfter
search DOM consumer full customized where to put the
searchElm
in thesidebarElm
.(sidebarElm)=>{ const insertElm = sidebarElm.querySelector( ANY_TARGET_YOU_WANT ); sidebarElm.insertBefore( searchElm, insertElm ); }
The insertBefore
and afterBefore
can convert to [before]
and [after]
in future for compatibility.
Thx for your patience on this @jhildenbiddle ! I'm okay with it. LGTM!
Summary
This PR contains a UI refresh and complete rewrite of the CSS used to style Docsify sites. Additional changes have been made to support that effort.
Goals
Modernize Docsify's user interface, CSS source, CSS dependencies, and CSS build processes The previous Docsify design (v4) was created in 2017 and has remained mostly unchanged since then. The CSS was authored to support legacy browsers like IE10/11 in a format that requires tools which have long since fallen out of favor (Stylus).
This update includes visual design changes, UX-related enhancements, and best practices that better align with modern expectations. The basic layout remains the the same but default styles have been updated, bugs have been fixed, new features have been added, and accessibility has been improved. The new CSS has been authored using modern CSS syntax (custom properties, nested selectors,
:has
,:is
,:where
, etc.) and build tools (PostCSS) that balance forward-looking CSS authoring with real-world browser compatibility.Simplify and expedite style/theme customization and maintenance Docsify v4 offered multiple themes, but only one theme ("Vue") was widely used and consistently updated by the Docsify team. Official Docsify v4 themes offered only one configurable "theme"-related option (theme color). A few third-party themes have been created by the community, but these are typically just copies of outdated versions of the "Vue" theme with a few minor changes (mostly color). A noteworthy exception is docsify-themeable which is a full CSS rewrite for use with Docsify v4 that provides a large number of configurable "theme properties" (CSS custom properties) that can be used for customization.
This update contains CSS which addresses all of the issues outlined above and takes into considerations lessons learned from the success of docsify-themeable: Docsify's "core" styles have been separated from "theme" styles (now referred to as theme "add-ons"), CSS custom properties have been added to provide fast and simple customization without having to navigate CSS rules, site administrators can mix-and-match the official "core" theme with multiple third-party add-ons as preferred, and the rarely used legacy themes have been removed so that Docsify maintainers have only one "core" stylesheet to maintain and test.
Prioritize Docsify v4 plugin compatibility (as much as possible) While this update contains signficant changes to the CSS that styles Docsify sites, the structure and class names used have remain largely unchanged. This is a conscience decision intended to limit the number of community plugins affected.
Changes
New "core" theme and theme "add-ons"
This is a simple but impactiful change to how we handle first- and third-party themes.
Docsify now offers one "core" theme. This theme contains all of the styles and theme properties needed to render a Docsify site. It is is designed to serve as a minimalist theme on its own, in combination with theme add-ons, and as a starting point for customization by applying class names or modifying theme properties.
Separating the "core" styles needed to render a Docsify site from the "add-on" styles typically associated with theming provides several important benefits.
vue.css
and making a few changes), community members are now encouraging to let the Docsify team handle the "core" CSS while they focus only on the styles they need to change. For example, the v5 "Vue" theme add-on transforms the v5 core theme to look nearly identical to the v4 theme but is less than 1kb in size. This transformation is done by changing 22 theme properties and adding only 3 new CSS rulesets.Details
main
branch. For now, see_vars.css
and_vars-advanced.css
for details.@media
attribute on<link>
element.kbd
styles<body>
option)page-link
,group
, andgroup-title
CSS classes to sidebar markup.Documentation updates
themeColor
andtopMargin
Miscellaneous updates
insertBefore
andinsertAfter
getAndRemoveDocisfyIgnoreConfig
name type (nowDocisfy
=>Docsify
)hiddenSidebar
istrue
inBrowser
constant (SSR deprecated, so no longer needed)Related issue, if any:
2429
2391
2287
2205
2112
1853
1836
1796
1522
1392
1375
1212
1181
1170
1167
528
What kind of change does this PR introduce?
Bugfix Feature Code style update Docs Build-related changes
For any code change,
Does this PR introduce a breaking change?
Yes
Tested in the following browsers: