diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..8e486f6180 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto eol=lf +*.cmd text eol=crlf +*.bat text eol=crlf diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md new file mode 100644 index 0000000000..a042faa678 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -0,0 +1,26 @@ +--- +name: Bug report +labels: [bug, needs-triage] +about: Create a report to help us improve +--- + + + +### Environment + +- [ ] Version of Docsy you are using: +- [ ] How are you using Docsy? As a: + - [ ] Hugo module + - [ ] NPM module + - [ ] Git submodule + - [ ] Other: +- [ ] Version of Hugo you are using (output of `hugo version`): +- [ ] OS: + - [ ] Linux + - [ ] macOS + - [ ] Windows + - [ ] Other: + +### Problem + + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000..2d8ed34148 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,9 @@ +blank_issues_enabled: false +contact_links: + - name: SUPPORT, ISSUES, and TROUBLESHOOTING + url: https://github.com/google/docsy/discussions + about: + Please DO NOT use GitHub issues for support requests, instead start a + discussion thread at https://github.com/google/docsy/discussions. Feel + free to open an issue once your problem is confirmed by the docsy + maintainers and/or the docsy community. diff --git a/.github/ISSUE_TEMPLATE/enhancement.md b/.github/ISSUE_TEMPLATE/enhancement.md new file mode 100644 index 0000000000..f8c78e4d91 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/enhancement.md @@ -0,0 +1,7 @@ +--- +name: Enhancement proposal +labels: [enhancement, needs-triage] +about: Propose an enhancement or submit a feature request +--- + + diff --git a/.github/workflows/smoke.yaml b/.github/workflows/smoke.yaml new file mode 100644 index 0000000000..e703deccdb --- /dev/null +++ b/.github/workflows/smoke.yaml @@ -0,0 +1,50 @@ +# Smoke test across OSs: build a Docsy-based site from scratch, +# using Docsy as hugo module and fetching Docsy via NPM. + +name: smoke + +on: + push: + branches: [main] + pull_request: + # schedule: # midnight every day + # - cron: '0 0 * * *' + workflow_dispatch: + +jobs: + new-site: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-latest, ubuntu-latest] + docsy-src: [NPM, HUGO_MODULE] + env: + BASE_REPO: ${{ github.repository }} + BRANCH: ${{ github.head_ref }} + PR_REPO: ${{ github.event.pull_request.head.repo.full_name }} + SHA: ${{ github.sha }} + # TODO: drop PR testing under Windows because it's too slow? + # if: github.event_name != 'pull_request' && matrix.os != 'windows-latest' + if: github.event_name != 'push' || github.repository == 'google/docsy' + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + cache: npm + cache-dependency-path: package.json + - run: tools/install-hugo.sh + shell: bash + - name: Make site (non-PR) + if: github.event_name != 'pull_request' + run: | + mkdir tmp && cd tmp && set -x + ../tools/make-site.sh -s ${{ matrix.docsy-src }} -r $BASE_REPO -v $SHA + shell: bash + - name: Make site from PR + if: github.event_name == 'pull_request' + run: | + mkdir tmp && cd tmp && set -x + ../tools/make-site.sh -s ${{ matrix.docsy-src }} -r $PR_REPO -v $BRANCH + shell: bash diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000000..e94081f037 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,28 @@ +# Build Docsy & the User Guide and run all repo checks across OSs. + +name: test + +on: + push: + branches: [main] + pull_request: + # schedule: + # - cron: '11 0 * * *' # 11 past midnight every day + workflow_dispatch: + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-latest, ubuntu-latest] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + cache: npm + cache-dependency-path: package.json + - run: npm install --omit=optional + - run: npm run test:all diff --git a/.gitignore b/.gitignore index f2a1c17703..b578b779ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules/ package-lock.json +/tmp # Hugo .hugo_build.lock diff --git a/.markdown-link-check.json b/.markdown-link-check.json new file mode 100644 index 0000000000..0cab66454b --- /dev/null +++ b/.markdown-link-check.json @@ -0,0 +1,16 @@ +{ + "ignorePatterns": [ + { + "pattern": "^http://localhost" + }, + { + "pattern": "^https://badges.netlify.com/api/docsydocs.svg\\?branch=main" + }, + { + "pattern": "https://docs.npmjs.com/cli/v10/using-npm/scripts#prepare-and-prepublish" + } + ], + "timeout": "3s", + "retryOn429": true, + "aliveStatusCodes": [200, 206] +} diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..f112941105 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +.editorconfig +.gitattributes +.gitignore +.nvmrc +.prettierignore +.s3deploy.yml diff --git a/.prettierrc.json b/.prettierrc.json index b7741bb100..4ecfc6442a 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,5 +1,5 @@ { - "semi": true, - "singleQuote": true, - "tabWidth": 4 + "proseWrap": "always", + "semi": true, + "singleQuote": true } diff --git a/.vscode/cspell.json b/.vscode/cspell.json index ea5585c098..3e4a324385 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -1,10 +1,6 @@ // For settings, see https://www.streetsidesoftware.com/vscode-spell-checker/docs/configuration/ { - "version": "0.2", - "caseSensitive": true, - "words": [ - "Docsy", - "shortcode", - "shortcodes" - ] + "version": "0.2", + "caseSensitive": true, + "words": ["Docsy", "hugo", "shortcode", "shortcodes", "warnf"] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e2003a4ad..91fc035330 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,22 +1,174 @@ # Changelog -Useful links: Docsy [releases][] & [tags][]. Jump to the [latest][] release. +We only document **breaking changes** and release **highlights** in this page. +For the full list of changes of any particular release, see the [release +notes][releases]. -For a list of issues targeted for the next release, see the [23Q2][] milestone. +Useful links: -## [0.8.0][releases] - next major release (unpublished yet) +- [Releases] & [tags]. Jump to the [latest] release. +- [Milestones] + +[latest]: https://github.com/google/docsy/releases/latest +[milestones]: https://github.com/google/docsy/milestones +[releases]: https://github.com/google/docsy/releases +[tags]: https://github.com/google/docsy/tags + +## 0.9.2 or 0.10.0 + +> ### UNRELEASED: this planned version is still under development + +For the full list of changes, see the [0.x.y] release notes. + +**Breaking changes**: + +- ... **New**: +**Other changes**: + +[0.x.y]: https://github.com/google/docsy/releases/latest?FIXME=v0.X.Y + +## 0.9.1 + +Patch release. For details, see [0.9.1]. + +[0.9.1]: https://github.com/google/docsy/releases/v0.9.1 + +## 0.9.0 + +For an introduction and commentary, see the [0.9.0 release report]. For the full +list of commits, see the [0.9.0] release notes. The most significant changes of +this release are listed next. + **Breaking changes**: +- **[Repository Links]** now work for [multi-language] sites ([#1744]). + + For any given page, repository links are now computed from a page's _resolved_ + `File` path — as resolved _through_ mount points, if any. That is, the + path used is the one that refers to the file's actual location on disk, not + it's logical path in Hugo's [union file system]. + + This is a breaking change for pages of sites that use mounts and + [path_base_for_github_subdir]. Projects will need to adjust the value of + [path_base_for_github_subdir] to be relative to the file's physical location. + +- Class names to disable [repository links] were misnamed with a suffix of the + form `--KIND`. The new suffix is `__KIND`. For details, see [Disabling links]. + +- **Heading self-link** support has been reimplemented and projects must now + explicitly enable the feature. For details, see [Heading self links]. + +**Footer changes**: refactoring, for easier customization, and simplification. +For details concerning all footer changes, see [#1818]. + +- **Footer layout** has been factored into parts: _left_, _right_, and _center_, + with _copyright_ a subpart of center. For details see [Footer layout] +- **Footer copyright**, supports date-range, and site copyright fallback. For + details, see [Footer copyright]. +- **Footer streamlined**: the About-page footer link and All-rights-reserved + text are now hidden by default. For details, see [Footer streamlined]. + **Other changes**: -## [0.7.1][] +- The latest release of **[Mermaid] resources** are now fetched at build time + ([#1410]). +- [Look and feel] updates. + +[0.9.0]: https://github.com/google/docsy/releases/v0.9.0 +[0.9.0 release report]: https://www.docsy.dev/blog/2024/0.9.0/ +[#1410]: https://github.com/google/docsy/pull/1410 +[#1744]: https://github.com/google/docsy/pull/1744 +[#1818]: https://github.com/google/docsy/pull/1818 +[disabling links]: + https://www.docsy.dev/docs/adding-content/repository-links/#disabling-links +[Footer layout]: https://www.docsy.dev/blog/2024/0.9.0/#footer-layout +[Footer copyright]: https://www.docsy.dev/blog/2024/0.9.0/#footer-copyright +[Footer streamlined]: https://www.docsy.dev/blog/2024/0.9.0/#footer-streamlined +[Heading self links]: https://www.docsy.dev/blog/2024/0.9.0/#heading-self-links +[look and feel]: https://www.docsy.dev/blog/2024/0.9.0/#look-and-feel +[mermaid]: + https://www.docsy.dev/docs/adding-content/diagrams-and-formulae/#diagrams-with-mermaid +[multi-language]: https://www.docsy.dev/docs/language/ +[path_base_for_github_subdir]: + https://www.docsy.dev/docs/adding-content/repository-links/#path_base_for_github_subdir-optional +[Repository Links]: https://www.docsy.dev/docs/adding-content/repository-links/ +[union file system]: + https://gohugo.io/getting-started/directory-structure/#union-file-system + +## 0.8.0 + +For the full list of changes, see the [0.8.0] release notes. + +**Breaking changes**: + +- Docsy is packaged as a **single Hugo module** ([#1120]). + - For details, see [Use Docsy as a Hugo Module]. +- **Important**: non-Hugo-module projects should read the [Docsy NPM install + side-effect] note. +- **Page feedback**, or [User feedback]: + - In support of projects configuring analytics outside of Docsy, feedback + functionality is enabled regardless of whether + `site.Config.Services.GoogleAnalytics.ID` is set ([#1727]). + - Feedback-event attribute changes ([#1726]): + - Event `name` is `page_helpful`rather than`click` + - Event `value` for "yes" is 100 by default, rather than 1, allowing for + more response options in the future. To override the default set + `params.ui.feedback.max_value`. +- SCSS: `@function prepend()` and file `assets/scss/support/_functions.scss` + have been dropped. Instead use the more general SASS/SCSS list `join()` + function ([#1385]). + +[#1120]: https://github.com/google/docsy/issues/1120 +[#1385]: https://github.com/google/docsy/issues/1385 +[#1726]: https://github.com/google/docsy/pull/1726 +[#1727]: https://github.com/google/docsy/pull/1727 +[0.8.0]: https://github.com/google/docsy/releases/v0.8.0 +[Docsy NPM install side-effect]: + https://docsy.dev/docs/get-started/other-options/#docsy-npm-install-side-effect +[Use Docsy as a Hugo Module]: + https://www.docsy.dev/docs/get-started/docsy-as-module/ +[User feedback]: + https://www.docsy.dev/docs/adding-content/feedback/#user-feedback + +## 0.7.2 + +For the full list of changes, see the [0.7.2] release notes. We mention some +noteworthy changes here: + +- **Algolia** + - [#1651] DocSearch fixed for mobile and for sites with two search boxes (in + the top and left navs). + - [#1662] DocSearch is supported by Docsy through site config. + - For details, see [Algolia DocSearch]. +- **[Tabbed panes]**: + - `persistLang` is deprecated, use `persist` instead + - Persistence is enabled by default (independent of the old `persistLang` + parameter value) ; to disable use `persist=disabled` + - Various fixes and enhancements, with more to come; for details, see [#1641] + and [Tabbed panes]. +- **Left-nav**, and **right-nav** (TOC + page meta): spacing issues have been + resolved; for details, see [#1661]. + +[#1641]: https://github.com/google/docsy/issues/1641 +[#1651]: https://github.com/google/docsy/pull/1651 +[#1661]: https://github.com/google/docsy/pull/1661 +[#1662]: https://github.com/google/docsy/pull/1662 +[0.7.2]: https://github.com/google/docsy/releases/v0.7.2 +[Algolia DocSearch]: + https://www.docsy.dev/docs/adding-content/search/#algolia-docsearch +[Tabbed panes]: + https://www.docsy.dev/docs/adding-content/shortcodes/#tabbed-panes + +## 0.7.1 + +For the full list of changes, see the [0.7.1] release notes. Followup changes to **Bootstrap (BS) 5.2 upgrade** ([#470]): @@ -27,8 +179,11 @@ Followup changes to **Bootstrap (BS) 5.2 upgrade** ([#470]): [#1560]: https://github.com/google/docsy/issues/1560 [#1579]: https://github.com/google/docsy/issues/1579 +[0.7.1]: https://github.com/google/docsy/releases/v0.7.1 + +## 0.7.0 -## [0.7.0][] +For the full list of changes, see the [0.7.0] release notes. **New**: @@ -52,7 +207,7 @@ Followup changes to **Bootstrap (BS) 5.2 upgrade** ([#470]): extension testing. ([#906]) - Dropped support for pre-Hugo-0.54.x behavior of `{{% %}}`. ([#939]) - `blocks/section`: **default** and accepted values of the `type` argument - have changed! For details see [blocks/section] ([#1472]). + have changed! For details, see [blocks/section] ([#1472]). - **Card shortcodes** ([#1376])]: - Renamed CSS class `td-card-deck` to `td-card-group`. - `card`, `card-code`: markup of inner content (HTML/markdown) now depends @@ -64,7 +219,7 @@ Followup changes to **Bootstrap (BS) 5.2 upgrade** ([#470]): [chroma-docsy]: https://www.docsy.dev/docs/adding-content/lookandfeel/#code-highlighting-with-chroma -- **Detection of draw.io diagrams** is now **disabled** by default [#1185][] +- **Detection of draw.io diagrams** is now **disabled** by default [#1185] **Other changes**: @@ -74,24 +229,24 @@ Followup changes to **Bootstrap (BS) 5.2 upgrade** ([#470]): - Non-breaking changes that result from the Bootstrap v5 upgrade: - Draw.io diagram edit button: replaced custom colors by BS's outline primary. -[#470]: https://github.com/google/docsy/issues/470 -[#906]: https://github.com/google/docsy/issues/906 -[#939]: https://github.com/google/docsy/issues/939 [#1185]: https://github.com/google/docsy/issues/1185 [#1369]: https://github.com/google/docsy/issues/1369 [#1376]: https://github.com/google/docsy/issues/1369 [#1442]: https://github.com/google/docsy/issues/1442 [#1472]: https://github.com/google/docsy/issues/1472 [#1523]: https://github.com/google/docsy/pull/1523 +[#470]: https://github.com/google/docsy/issues/470 +[#906]: https://github.com/google/docsy/issues/906 +[#939]: https://github.com/google/docsy/issues/939 +[0.7.0]: https://github.com/google/docsy/releases/v0.7.0 [blocks/section]: https://www.docsy.dev/docs/adding-content/shortcodes/#blockssection [bsv5mig]: https://getbootstrap.com/docs/5.2/migration/ [hugo-releases]: https://github.com/gohugoio/hugo/releases -## [0.6.0][] +## 0.6.0 -For the full list of the changes found in this release, see the [release -notes][0.6.0]. +For the full list of changes, see the [0.6.0] release notes. With this release we declare a feature freeze while we migrate to the newest Bootstrap version. See [the announcement][bs-announcement] for more information. @@ -107,19 +262,22 @@ Bootstrap version. See [the announcement][bs-announcement] for more information. `chem` blocks via KateX and mhchem. Support for formula rendering activation on individual pages only. Hugo version >= 0.93.0 required. -## [0.5.1][] +[0.6.0]: https://github.com/google/docsy/releases/v0.6.0 +[bs-announcement]: https://github.com/google/docsy/discussions/1308 -For the full list of the changes found in this release, see the [release -notes][0.5.1]. **BREAKING CHANGES** are documented below. +## 0.5.1 + +For the full list of changes, see the [0.5.1] release notes. **BREAKING +CHANGES** are documented below. **After you update** your project's Docsy: -- Update your project setup (see [0.4.0][]) if you haven't already. +- Update your project setup (see [0.4.0]) if you haven't already. - Run `npm install`. **New**: -- Projects can now install and use [Docsy as an NPM package][]. +- Projects can now install and use [Docsy as an NPM package]. **Breaking changes**: @@ -132,22 +290,23 @@ notes][0.5.1]. **BREAKING CHANGES** are documented below. - **Display logo by default**. Most projects show their logo in the navbar. In support of this majority, Docsy now displays a logo by default. For details on how to hide the logo (or your brand name), see [Styling your project logo and - name][]. + name]. - **Upgraded Bootstrap** to v4.6.2 from v4.6.1, resulting in some style changes (such as an adjustment in the size of `small`). For details, see [v4.6.2 - release notes][]. -- **[Upgraded FontAwesome][]** to v6 from v5. While many icons were renamed, the + release notes]. +- **[Upgraded FontAwesome]** to v6 from v5. While many icons were renamed, the v5 names still work. For details about icon renames and more, see [What's - changed][]. + changed]. - **Search-box**: the HTML structure and class names have changed, due to the Font Awesome upgrade, for both online and offline search. This may affect your project if you have overridden search styling or scripts. **Other changes**: -- By default, Docsy now uses the [gtag.js][] analytics library for all site - tags. For details, see [Adding Analytics > Setup][]. +- By default, Docsy now uses the [gtag.js] analytics library for all site tags. + For details, see [Adding Analytics > Setup]. +[0.5.1]: https://github.com/google/docsy/releases/v0.5.1 [adding analytics > setup]: https://www.docsy.dev/docs/adding-content/feedback/#setup [v4.6.2 release notes]: https://github.com/twbs/bootstrap/releases/tag/v4.6.2 @@ -159,14 +318,14 @@ notes][0.5.1]. **BREAKING CHANGES** are documented below. [upgraded fontawesome]: https://fontawesome.com/docs/web/setup/upgrade/ [what's changed]: https://fontawesome.com/docs/web/setup/upgrade/whats-changed -## [0.5.0][] +## 0.5.0 Unpublished. -## [0.4.0][] +## 0.4.0 -For a full list of the changes to this release, see the [release notes][0.4.0]. -Potential **BREAKING CHANGES** are documented below. +For the full list of changes, see the [0.4.0] release notes. Potential +**BREAKING CHANGES** are documented below. **After you update** your project's Docsy, run `npm install`. @@ -174,8 +333,8 @@ Potential **BREAKING CHANGES** are documented below. If your project uses Docsy as follows: -- [Hugo Module][], then this change doesn't impact you. -- For [other Docsy setups][], this is a **BREAKING CHANGE** -- read on. +- [Hugo Module], then this change doesn't impact you. +- For [other Docsy setups], this is a **BREAKING CHANGE** -- read on. Docsy now fetches Bootstrap and FontAwesome as NPM packages rather than git submodules. This has an impact on your project-build setup. To migrate your @@ -195,7 +354,7 @@ site, follow these steps (execute commands from your project's root directory): ``` 3. Update your build scripts to fetch Docsy dependencies automatically. For example, if your site build uses NPM scripts, consider getting Docsy - dependencies via a [prepare][] script as follows: + dependencies via a [prepare] script as follows: ```json { "name": "my-website", @@ -213,14 +372,15 @@ site, follow these steps (execute commands from your project's root directory): Proceed as usual to build or serve your site. +[0.4.0]: https://github.com/google/docsy/releases/v0.4.0 [hugo module]: https://www.docsy.dev/docs/get-started/docsy-as-module/ [other docsy setups]: https://www.docsy.dev/docs/get-started/other-options/ [prepare]: - https://docs.npmjs.com/cli/v8/using-npm/scripts#prepare-and-prepublish + https://docs.npmjs.com/cli/v10/using-npm/scripts#prepare-and-prepublish -## [0.3.0][] +## 0.3.0 -For a full list of the changes to this release, see the [release notes][0.3.0]. +For the full list of changes, see the [0.3.0] release notes. **Breaking changes**: @@ -228,52 +388,50 @@ For a full list of the changes to this release, see the [release notes][0.3.0]. [Algolia DocSearch v3](https://docsearch.algolia.com/docs/DocSearch-v3). If your site uses the deprecated DocSearch v2, you must [update your DocSearch code](https://docsearch.algolia.com/docs/migrating-from-v2). -- (**Edit**) [PR #1009][] inadvertently changed the base [Bootstrap styles for +- (**Edit**) [#1009] inadvertently changed the base [Bootstrap styles for cards][bs4cards], as well as the Docsy `highlight` style. For details, see - [issue #1154][]. Release [0.5.0][] includes a fix. + [issue #1154]. Release [0.5.1] includes a fix. +[0.3.0]: https://github.com/google/docsy/releases/v0.3.0 [bs4cards]: https://getbootstrap.com/docs/4.1/components/card/ -[pr #1009]: https://github.com/google/docsy/pull/1009 +[#1009]: https://github.com/google/docsy/pull/1009 [issue #1154]: https://github.com/google/docsy/issues/1154 -## [0.2.0][] +## 0.2.0 + +For the full list of changes, see the [0.2.0] release notes. **New**: -- Add official Docsy support for [Hugo modules][]. Many thanks to the dedicated - and patient efforts of [@deining][], who researched, experimented, and - implemented this feature. Thanks to [@deining][] and [@LisaFC][] for the doc +- Add official Docsy support for [Hugo modules]. Many thanks to the dedicated + and patient efforts of [@deining], who researched, experimented, and + implemented this feature. Thanks to [@deining] and [@LisaFC] for the doc updates. For details, see [Migrate to Hugo Modules](https://www.docsy.dev/docs/updating/convert-site-to-module/). -**Details**: +[@deining]: https://github.com/deining +[@lisafc]: https://github.com/LisaFC +[0.2.0]: https://github.com/google/docsy/releases/v0.2.0 +[hugo modules]: https://gohugo.io/hugo-modules/ + + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 82ccce057c..1177c58f41 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,11 +1,11 @@ - + # How to Contribute We'd love to accept your patches and contributions to this project. There are just a few small guidelines you need to follow. -## Contributor License Agreement +## Contributor License Agreement (CLA) Contributions to this project must be accompanied by a Contributor License Agreement. You (or your employer) retain the copyright to your contribution; @@ -24,14 +24,17 @@ use GitHub pull requests for this purpose. Consult [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more information on using pull requests. -## Community Guidelines +## Community Guidelines / Code of conduct This project follows [Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). ## Student contributions -Docsy welcomes contributions from students. However, we cannot guarantee that PRs will be merged within any specific timeframe. We ask that instructors *not* create assignments requiring students to have PRs merged into the project. We will not merge PRs solely to satisfy any class assignments. +Docsy welcomes contributions from students. However, we cannot guarantee that +PRs will be merged within any specific time frame. We ask that instructors _not_ +create assignments requiring students to have PRs merged into the project. We +will not merge PRs solely to satisfy any class assignments. ## How to contribute @@ -39,65 +42,94 @@ See the [contribution guidelines][] in the Docsy user guide. ## Publishing a release -These notes are WIP for creating a release (v0.X.Y) from a local copy of the +These notes are WIP for creating a **release (v0.X.Y)** from a local copy of the repo. -1. Change directory to your local Docsy repo. -2. Ensure that the [CHANGELOG](CHANGELOG.md) has a release summary entry for - v0.X.Y. If not, create one with a brief summary of breaking changes using - the section template at the end of the file. (Note that change details are - autogenerated by GitHub in a later step.) -3. Update module and package versions: - - Update the version of `docsy/dependencies` in [go.mod](go.mod) to v0.X.Y. - - Update the NPM package version in [package.json](package.json) to 0.X.Y. -4. Update the Docsy `version` in [userguide/hugo.toml][] to 0.X.Y. -5. Commit your changes, usually as a PR entitled "Release v0.X.Y preparation". - Once the PR is approved and merged, proceed with the remaining steps. -6. Ensure that you're: - - On the default branch - - At the commit that you want to tag as the next release (usually `@HEAD`). -7. Create the tags for v0.X.Y (we currently need two): +1. **Change directory** to your local Docsy repo. +2. **Create or update a [CHANGELOG] entry** for v0.X.Y. The section should + provide a brief summary of breaking changes using the section template at + the end of the file. (Note that change details are autogenerated by GitHub + in a later step.) +3. **Update Docsy version** to v0.X.Y for: + - `version` key in [package.json](package.json) + - `version` key in [userguide/hugo.yaml][] +4. Run `npm install` to have vendor assets and [go.mod](go.mod) updated for + dependencies. +5. **Submit a PR with your changes**, using a title like "Release v0.X.Y + preparation". +6. **Test the PR** branch from selected sites, and push any required + adjustments. + - If the test site uses Docsy as a Git submodule: + ```console + $ cd themes/docs + $ git fetch + $ git switch -t repo/branch-name # e.g. chalin/chalin-im-0.9.1-2024-02-16 + ``` +7. **Get PR approved and merged**. +8. **Pull in `main`** to get the last PR. +9. **Ensure** that you're: + - On the default branch, `main` + - At the commit that you want to tag as v0.X.Y +10. **Create tags** for v0.X.Y: ```sh REL=v0.X.Y git tag $REL - git tag dependencies/$REL ``` -8. Push the new tags to the main repo (which is named `upstream` in the - following setup): +11. **Push the new tags** to the main remote (`origin` or `upstream` depending + on your setup) as well as any secondary remotes, if any: ```console - $ git push upstream $REL && git push upstream dependencies/$REL + $ git push upstream $REL ... * [new tag] v0.X.Y -> v0.X.Y - * [new tag] dependencies/v0.X.Y -> dependencies/v0.X.Y ``` -9. Use the GitHub [Draft a new release][] feature, filling in the fields as - follows: +12. **[Draft a new release][]** using GitHub web; fill in the fields as follows: - From the **release/tag dropdown**: Select the new release tag that you just pushed, v0.X.Y. - Set the **release title** to the release number (without the "v"). - - Click "auto-generate release notes" to get the release details. - - Replace the auto-generated "## What's Changed" heading by the following: + - Click **Generate release notes** to get the release details inserted into + the release notes text area. + - Add the following text atop the generated release notes, but replace the + `0XY` anchor target with a target appropriate for this release: ```markdown ## Release summary - See, https://github.com/google/docsy/blob/main/CHANGELOG.md#0XY - - ## Commit details + - [Release report](https://www.docsy.dev/blog/2024/0.X.Y/) + - [CHANGELOG](https://github.com/google/docsy/blob/main/CHANGELOG.md#0XY) ``` - - Replace the `0XY` anchor target above with a target appropriate for this - release. - - Remove the "New contributors" autogenerated text (if present) since we - don't publish that as part of our release notes. - Select **Create a discussion for this release**. - - Click **Publish release**. +13. **Publish the release**: click _Publish release_. +14. Test the release with a downstream project, such as [docsy-example]. +15. If you find issues, determine whether they need to be fixed immediately. If + so, get fixes submitted, reviewed and approved. Then publish a dot release: + go back to step 1. + +## Post-release followup + +Assuming that Docsy release v0.X.Y has been successfully deployed and use by at +least one downstream project, then perform the following actions before any +further changes are merged into the default branch: + +1. Set `version` in [package.json](package.json) to the next planned (or the + next dot) release with a dev suffix, such as `v0.X.Z-dev.0-unreleased`. +2. In the [CHANGELOG]: + - **Create a new entry** for the next release by copying the ENTRY TEMPLATE + at the end of the file. + - **Pin the 0.X.Y release URL**, which ends with `latest?FIXME=...`, to the + v0.X.Y release at `https://github.com/google/docsy/releases/v0.x.y`. +3. **Submit a PR with your changes**, using a title like "Set NPM package + version to next unreleased dev vers". +4. **Get PR approved and merged**. + +[CHANGELOG]: CHANGELOG.md [contribution guidelines]: https://www.docsy.dev/docs/contribution-guidelines/ +[docsy-example]: https://github.com/google/docsy-example [Draft a new release]: https://github.com/google/docsy/releases/new -[userguide/hugo.toml]: userguide/hugo.toml +[userguide/hugo.yaml]: userguide/hugo.yaml diff --git a/Dockerfile b/Dockerfile index 9a2289f775..7030369bde 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM klakegg/hugo:0.101.0-ext-alpine as docsy-user-guide +FROM klakegg/hugo:0.111.3-ext-alpine as docsy-user-guide RUN apk update RUN apk add git diff --git a/README.md b/README.md index ff2e78953e..a68147e22d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # Docsy +[![Project status: active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) +[![Project releases](https://img.shields.io/github/release/google/docsy)](https://github.com/google/docsy/releases) +[![Project build Status](https://badges.netlify.com/api/docsydocs.svg?branch=main)](https://app.netlify.com/sites/docsydocs/deploys) +[![Project contributors](https://img.shields.io/github/contributors/google/docsy)](https://github.com/google/docsy/graphs/contributors) +[![Project license](https://img.shields.io/github/license/google/docsy)](https://github.com/google/docsy/blob/main/LICENSE) + ## 🚧 WARNING 🚧 : `main` is under development and potentially unstable! Use official Docsy [releases]. Docsy is a [Hugo](https://gohugo.io) theme for technical documentation sets, @@ -36,7 +42,7 @@ The following are basic prerequisites for using Docsy in your site: Any additional prerequisites depend on the [installation option](https://www.docsy.dev/docs/get-started/#installation-options) you choose. We recommend using Docsy as a Hugo module, which requires that you -have the `go` language installed in addition to Hugo and PostCSS. +have the Go language installed in addition to Hugo and PostCSS. For complete prerequisites and instructions, see our [Get started guides](https://www.docsy.dev/docs/get-started/). @@ -66,9 +72,9 @@ details about the various usage options. ## Documentation Docsy has its own user guide (using Docsy, of course!) with lots more -information about using the theme. It is hosted by [Netlify][] at -[docsy.dev](https://docsy.dev). For deploy logs and more, see [Deploys][] from -the site's Netlify dashboard. +information about using the theme. It is hosted by [Netlify] at +[docsy.dev](https://docsy.dev). For deploy logs and more, see [Deploys] from the +site's Netlify dashboard. Alternatively you can use Hugo to generate and serve a local copy of the guide (also useful for testing local theme changes), making sure you have installed @@ -81,20 +87,21 @@ npm install npm run serve ``` -## Contributing ![GitHub](https://img.shields.io/github/contributors/google/docsy) +## Contributing -Please read -[CONTRIBUTING.md](https://github.com/google/docsy/blob/main/CONTRIBUTING.md) for -details on our code of conduct, and the process for submitting pull requests to -us. See also the list of -[contributors](https://github.com/google/docsy/graphs/contributors) who -participated in this project. +For details on our [code of conduct] and the process for submitting pull +requests, see [CONTRIBUTING.md]. Thank you to all past, present, and future +[contributors]! -## License ![GitHub](https://img.shields.io/github/license/google/docsy) +## License This project is licensed under the Apache License 2.0 - see the [LICENSE.md](https://github.com/google/docsy/blob/main/LICENSE) file for details +[code of conduct]: + https://github.com/google/.github/blob/master/CODE_OF_CONDUCT.md +[CONTRIBUTING.md]: https://github.com/google/docsy/blob/main/CONTRIBUTING.md +[contributors]: https://github.com/google/docsy/graphs/contributors [deploys]: https://app.netlify.com/sites/docsydocs/deploys [netlify]: https://netlify.com [releases]: https://github.com/google/docsy/releases diff --git a/assets/_vendor/README.md b/assets/_vendor/README.md new file mode 100644 index 0000000000..730dba449c --- /dev/null +++ b/assets/_vendor/README.md @@ -0,0 +1,5 @@ +This `_vendor` folder exists to work around a known bug in Go’s module +management. For details, see . + +DO NOT EDIT or manually override the files in this folder. They are +automatically synchronized at installation time. diff --git a/dependencies/assets/bootstrap/scss/_vendor/_rfs.scss b/assets/_vendor/bootstrap/scss/_rfs.scss similarity index 90% rename from dependencies/assets/bootstrap/scss/_vendor/_rfs.scss rename to assets/_vendor/bootstrap/scss/_rfs.scss index 7e9a6c7a8a..aa1f82b961 100644 --- a/dependencies/assets/bootstrap/scss/_vendor/_rfs.scss +++ b/assets/_vendor/bootstrap/scss/_rfs.scss @@ -1,4 +1,4 @@ -// stylelint-disable property-blacklist, scss/dollar-variable-default +// stylelint-disable scss/dimension-no-non-numeric-values // SCSS RFS mixin // @@ -154,8 +154,7 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height &.enable-rfs { @content; } - } - @else { + } @else { @content; } } @@ -168,7 +167,7 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height @content; } - @include _rfs-media-query { + @include _rfs-media-query () { .enable-rfs &, &.enable-rfs { @content; @@ -182,7 +181,7 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height @content; } } - @include _rfs-media-query { + @include _rfs-media-query () { @content; } } @@ -193,12 +192,12 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height // Convert to list $values: if(type-of($values) != list, ($values,), $values); - $val: ''; + $val: ""; // Loop over each value and calculate value @each $value in $values { @if $value == 0 { - $val: $val + ' 0'; + $val: $val + " 0"; } @else { // Cache $value unit @@ -206,15 +205,14 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height @if $unit == px { // Convert to rem if needed - $val: $val + ' ' + if($rfs-unit == rem, #{divide($value, $value * 0 + $rfs-rem-value)}rem, $value); + $val: $val + " " + if($rfs-unit == rem, #{divide($value, $value * 0 + $rfs-rem-value)}rem, $value); } @else if $unit == rem { // Convert to px if needed - $val: $val + ' ' + if($rfs-unit == px, #{divide($value, $value * 0 + 1) * $rfs-rem-value}px, $value); - } - @else { + $val: $val + " " + if($rfs-unit == px, #{divide($value, $value * 0 + 1) * $rfs-rem-value}px, $value); + } @else { // If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value - $val: $val + ' ' + $value; + $val: $val + " " + $value; } } } @@ -228,30 +226,26 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height // Convert to list $values: if(type-of($values) != list, ($values,), $values); - $val: ''; + $val: ""; // Loop over each value and calculate value @each $value in $values { @if $value == 0 { - $val: $val + ' 0'; - } - - @else { + $val: $val + " 0"; + } @else { // Cache $value unit $unit: if(type-of($value) == "number", unit($value), false); // If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value @if not $unit or $unit != px and $unit != rem { - $val: $val + ' ' + $value; - } - - @else { + $val: $val + " " + $value; + } @else { // Remove unit from $value for calculations $value: divide($value, $value * 0 + if($unit == px, 1, divide(1, $rfs-rem-value))); // Only add the media query if the value is greater than the minimum value @if abs($value) <= $rfs-base-value or not $enable-rfs { - $val: $val + ' ' + if($rfs-unit == rem, #{divide($value, $rfs-rem-value)}rem, #{$value}px); + $val: $val + " " + if($rfs-unit == rem, #{divide($value, $rfs-rem-value)}rem, #{$value}px); } @else { // Calculate the minimum value @@ -273,7 +267,7 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height $variable-width: #{divide($value-diff * 100, $rfs-breakpoint)}#{$variable-unit}; // Return the calculated value - $val: $val + ' calc(' + $min-width + if($value < 0, ' - ', ' + ') + $variable-width + ')'; + $val: $val + " calc(" + $min-width + if($value < 0, " - ", " + ") + $variable-width + ")"; } } } @@ -287,22 +281,22 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height @mixin rfs($values, $property: font-size) { @if $values != null { $val: rfs-value($values); - $fluidVal: rfs-fluid-value($values); + $fluid-val: rfs-fluid-value($values); // Do not print the media query if responsive & non-responsive values are the same - @if $val == $fluidVal { + @if $val == $fluid-val { #{$property}: $val; } @else { - @include _rfs-rule { - #{$property}: if($rfs-mode == max-media-query, $val, $fluidVal); + @include _rfs-rule () { + #{$property}: if($rfs-mode == max-media-query, $val, $fluid-val); // Include safari iframe resize fix if needed min-width: if($rfs-safari-iframe-resize-bug-fix, (0 * 1vw), null); } - @include _rfs-media-query-rule { - #{$property}: if($rfs-mode == max-media-query, $fluidVal, $val); + @include _rfs-media-query-rule () { + #{$property}: if($rfs-mode == max-media-query, $fluid-val, $val); } } } diff --git a/assets/js/anchor.js b/assets/js/anchor.js deleted file mode 100644 index 9d8a0e6784..0000000000 --- a/assets/js/anchor.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2018 Google LLC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -(function ($) { - 'use strict'; - - // Headers' anchor link that shows on hover - $(function () { - // append anchor links to headings in markdown. - var article = document.getElementsByTagName('main')[0]; - if (!article) { - return; - } - var headings = article.querySelectorAll('h1, h2, h3, h4, h5, h6'); - headings.forEach(function (heading) { - if (heading.id) { - var a = document.createElement('a'); - // set visibility: hidden, not display: none to avoid layout change - a.style.visibility = 'hidden'; - // [a11y] hide this from screen readers, etc.. - a.setAttribute('aria-hidden', 'true'); - // material insert_link icon in svg format - a.innerHTML = ' '; - a.href = '#' + heading.id; - heading.insertAdjacentElement('beforeend', a); - heading.addEventListener('mouseenter', function () { - a.style.visibility = 'initial'; - }); - heading.addEventListener('mouseleave', function () { - a.style.visibility = 'hidden'; - }); - } - }); - }); - -}(jQuery)); diff --git a/assets/scss/_blog.scss b/assets/scss/_blog.scss index 6cc7d5dd60..b63fa65377 100644 --- a/assets/scss/_blog.scss +++ b/assets/scss/_blog.scss @@ -4,6 +4,7 @@ @extend .btn-info; @extend .btn-lg; + border-radius: 2rem; float: right; display: none; diff --git a/assets/scss/_buttons.scss b/assets/scss/_buttons.scss deleted file mode 100644 index 2139b5b4ca..0000000000 --- a/assets/scss/_buttons.scss +++ /dev/null @@ -1,15 +0,0 @@ -// Buttons - -@if $enable-rounded { - .btn { - border-radius: 1rem; - - &-lg { - border-radius: 2rem; - } - - &-sm { - border-radius: 1rem; - } - } -} diff --git a/assets/scss/_code.scss b/assets/scss/_code.scss index 5307fea13c..781b6425d7 100644 --- a/assets/scss/_code.scss +++ b/assets/scss/_code.scss @@ -17,6 +17,7 @@ pre { margin: 0; padding: 1rem; + border-radius: inherit; // Default click-to-copy button diff --git a/assets/scss/_content.scss b/assets/scss/_content.scss index 4a75992d5f..364aff2421 100644 --- a/assets/scss/_content.scss +++ b/assets/scss/_content.scss @@ -94,3 +94,27 @@ font-size: 3rem; } } + +.td-heading-self-link { + &:before { + content: '#'; + } + + font-size: 90%; + padding-left: 0.25em; + text-decoration: none; + visibility: hidden; + + // Always visible on touch devices and small screens + @media (hover: none) and (pointer: coarse), + (max-width: map-get($grid-breakpoints, sm)) { + visibility: visible; + } + +} + +@for $i from 1 through 6 { + h#{$i}:hover > .td-heading-self-link { + visibility: visible; + } +} diff --git a/assets/scss/_pageinfo.scss b/assets/scss/_pageinfo.scss index c855dae791..61c95f60bb 100644 --- a/assets/scss/_pageinfo.scss +++ b/assets/scss/_pageinfo.scss @@ -14,3 +14,12 @@ } } } + +.td-page-meta { + &__lastmod { + @extend .text-muted; + @extend .border-top; + margin-top: map-get($spacers, 5) !important; + padding-top: map-get($spacers, 3) !important; + } +} diff --git a/assets/scss/_search.scss b/assets/scss/_search.scss index 4be6ee767c..d9374a7fbb 100644 --- a/assets/scss/_search.scss +++ b/assets/scss/_search.scss @@ -37,10 +37,6 @@ width: 100%; text-indent: 1.25em; - @if $enable-rounded { - border-radius: 1rem; - } - &:not(:focus) { background: transparent; } @@ -80,6 +76,15 @@ } } +.td-sidebar .td-search--algolia { + display: block; + padding: 0 0.5rem; + > button { + margin: 0; + width: 100%; + } +} + // Offline search .td-search--offline { diff --git a/assets/scss/_sidebar-toc.scss b/assets/scss/_sidebar-toc.scss index 249ec25f39..02ba55621a 100644 --- a/assets/scss/_sidebar-toc.scss +++ b/assets/scss/_sidebar-toc.scss @@ -2,6 +2,8 @@ // Right side toc // .td-sidebar-toc { + @include link-decoration; + border-left: 1px solid $border-color; @supports (position: sticky) { @@ -15,10 +17,8 @@ padding-top: 0.75rem; padding-bottom: 1.5rem; vertical-align: top; -} -.td-page-meta { - a { + .td-page-meta a { display: block; font-weight: $font-weight-medium; } @@ -48,9 +48,9 @@ a { color: $gray-600; + &:focus, &:hover { - color: $blue; - text-decoration: none; + color: initial; } } } diff --git a/assets/scss/_sidebar-tree.scss b/assets/scss/_sidebar-tree.scss index a7b92bb4cc..05ae66a14f 100644 --- a/assets/scss/_sidebar-tree.scss +++ b/assets/scss/_sidebar-tree.scss @@ -2,17 +2,34 @@ // Left side navigation // .td-sidebar-nav { + $_max-height: calc(100vh - 8.5rem); + padding-right: 0.5rem; margin-right: -15px; margin-left: -15px; @include media-breakpoint-up(md) { @supports (position: sticky) { - max-height: calc(100vh - 10rem); + max-height: $_max-height; overflow-y: auto; } } + // Adjust height and padding when sidebar_search_disable is true, but only for + // >= `lg` views, because on tablet (`md`) and mobile (<= `sm`), the search + // box is displayed regardless of the value of sidebar_search_disable: + &.td-sidebar-nav--search-disabled { + @include media-breakpoint-up(lg) { + // There's no search box so add top padding + // and adjust max-height: + padding-top: 1rem; + + @supports (position: sticky) { + max-height: calc(#{$_max-height} + 4.5rem); + } + } + } + @include media-breakpoint-up(md) { display: block !important; } @@ -22,7 +39,7 @@ list-style: none; } - ul { + &.ul-0, ul { padding: 0; margin: 0; } @@ -60,9 +77,9 @@ } a { + &:focus, &:hover { - color: $blue; - text-decoration: none; + color: $link-color; } &.active { @@ -103,6 +120,8 @@ } .td-sidebar { + @include link-decoration; + @include media-breakpoint-up(md) { padding-top: 4rem; background-color: $td-sidebar-bg-color; @@ -119,9 +138,7 @@ } &__search { - padding: 1rem 15px; - margin-right: -15px; - margin-left: -15px; + padding: 1rem 0; } &__inner { @@ -132,7 +149,7 @@ position: sticky; top: 4rem; z-index: 10; - height: calc(100vh - 6rem); + height: calc(100vh - 5rem); } } diff --git a/assets/scss/_swagger.scss b/assets/scss/_swagger.scss new file mode 100644 index 0000000000..c504057ef3 --- /dev/null +++ b/assets/scss/_swagger.scss @@ -0,0 +1,3 @@ +.swagger-ui .info .title small pre { + background: #7d8492; +} \ No newline at end of file diff --git a/assets/scss/_variables.scss b/assets/scss/_variables.scss index 4f02e2b659..a0d5d2b0cb 100644 --- a/assets/scss/_variables.scss +++ b/assets/scss/_variables.scss @@ -34,8 +34,7 @@ $td-sidebar-border-color: $border-color !default; $td-box-colors: $dark, $primary, $secondary, $info, $white, $gray-600, $success, $warning, $dark, $danger, $primary, $secondary, $info !default; -$link-color: $blue-500; -$link-decoration: none !default; +$link-color: $blue-500 !default; $link-shade-percentage: 30% !default; // Fonts @@ -52,7 +51,7 @@ $td-fonts-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Segoe UI Symbol"; @if $td-enable-google-fonts { - $td-fonts-serif: prepend($td-fonts-serif, "#{$google_font_name}"); + $td-fonts-serif: join("#{$google_font_name}", $td-fonts-serif); } $font-family-sans-serif: $td-fonts-serif !default; // TODO: consider moving into UG SCSS or namespace the var (td-) diff --git a/assets/scss/main.scss b/assets/scss/main.scss index 84bf68781a..2152c7383e 100644 --- a/assets/scss/main.scss +++ b/assets/scss/main.scss @@ -1,6 +1,5 @@ @import "../vendor/bootstrap/scss/functions"; -@import "support/functions"; @import "_variables_forward"; @import "variables_project"; @import "variables"; @@ -22,7 +21,6 @@ @import "nav"; @import "sidebar-tree"; @import "sidebar-toc"; -@import "buttons"; @import "breadcrumb"; @import "alerts"; @import "content"; @@ -34,6 +32,8 @@ @import "taxonomy"; @import "drawio"; @import "shortcodes"; +@import "swagger"; + @if $td-enable-google-fonts { @import url($web-font-path); @@ -49,9 +49,17 @@ min-height: 200px; } - &__copyright-etc { + /* &__left { } */ + + &__center { @extend .small; + text-align: center; + } + + &__right { + text-align: right; } + &__about { font-size: initial; } @@ -72,6 +80,14 @@ } } + &__authors, + &__all_rights_reserved { + padding-left: map-get($spacers, 1); + } + + &__all_rights_reserved { + display: none; + } } // Adjust anchors vs the fixed menu. diff --git a/assets/scss/shortcodes/tabbed-pane.scss b/assets/scss/shortcodes/tabbed-pane.scss index 65096aee6e..c30081191d 100644 --- a/assets/scss/shortcodes/tabbed-pane.scss +++ b/assets/scss/shortcodes/tabbed-pane.scss @@ -1,21 +1,17 @@ -.tab-content { - .tab-pane { - pre { - margin: 0rem 0 0rem 0; - } - } +// Only constrain max-width for top-level tabbed panes not, e.g., those in lists. +.td-content > .tab-content .tab-pane { + @extend .td-max-width-on-larger-screens; } .tab-content { .tab-pane { .highlight { - margin: 0rem 0 0rem 0; + margin: 0; border: none; max-width: 100%; } margin-top: 0rem; margin-bottom: 1.5rem; - max-width: 80%; border-left: 1px solid rgba(0, 0, 0, 0.125); border-right: 1px solid rgba(0, 0, 0, 0.125); border-bottom: 1px solid rgba(0, 0, 0, 0.125); @@ -29,6 +25,15 @@ border-radius: 0; padding: 1.5rem; + > :last-child { + margin-bottom: 0; + } + + > .highlight:only-child { + margin: -1.5rem; + max-width: calc(100% + 3rem); + } + @each $color, $value in $theme-colors { &-#{$color} { border-style: solid; diff --git a/assets/scss/support/_bootstrap_vers_test.scss b/assets/scss/support/_bootstrap_vers_test.scss index c5c0f25356..c65647acb8 100644 --- a/assets/scss/support/_bootstrap_vers_test.scss +++ b/assets/scss/support/_bootstrap_vers_test.scss @@ -1,8 +1,8 @@ $enable-important-utilities: null !default; @if $enable-important-utilities == null { - @error " - Docsy requires Bootstrap v5, but the v5 variable - $enable-important-utilities isn't defined. - Did you forget to update Docsy dependencies? + @error "\ + Docsy requires Bootstrap v5, but the v5 variable \ + $enable-important-utilities isn't defined. \ + Did you forget to update Docsy dependencies?\ "; } diff --git a/assets/scss/support/_functions.scss b/assets/scss/support/_functions.scss deleted file mode 100644 index e0d0b6b87f..0000000000 --- a/assets/scss/support/_functions.scss +++ /dev/null @@ -1,5 +0,0 @@ -// Common functions. - -@function prepend($list, $value) { - @return join($value, $list); -} diff --git a/assets/scss/support/_mixins.scss b/assets/scss/support/_mixins.scss index 282bd51e27..61c70501cd 100644 --- a/assets/scss/support/_mixins.scss +++ b/assets/scss/support/_mixins.scss @@ -1,5 +1,20 @@ // Mixins +@mixin link-decoration($base: none, $focus_or_hover: initial) { + a { + text-decoration: $base; + + &:focus, + &:hover { + text-decoration: $focus_or_hover; + } + } + + .btn-link { + text-decoration: $base; + } +} + @mixin link-variant($parent, $color, $hover-color, $underline: false) { #{$parent} { color: $color; diff --git a/dependencies/assets/bootstrap/README.txt b/dependencies/assets/bootstrap/README.txt deleted file mode 100644 index eb9a64e177..0000000000 --- a/dependencies/assets/bootstrap/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -This folder was added in order to work around a known bug in Go’s module management. -For details, please refer to: https://github.com/golang/go/issues/37397 diff --git a/dependencies/assets/bootstrap/scss/_vendor/README.txt b/dependencies/assets/bootstrap/scss/_vendor/README.txt deleted file mode 100644 index bbc3d024e1..0000000000 --- a/dependencies/assets/bootstrap/scss/_vendor/README.txt +++ /dev/null @@ -1,3 +0,0 @@ -This file belongs to bootstrap framework: - -https://raw.githubusercontent.com/twbs/bootstrap/v4.6.1/scss/vendor/_rfs.scss \ No newline at end of file diff --git a/dependencies/config.toml b/dependencies/config.toml deleted file mode 100644 index a701110574..0000000000 --- a/dependencies/config.toml +++ /dev/null @@ -1,43 +0,0 @@ -[module] -_merge = "deep" -# work around https://github.com/golang/go/issues/37397 -[[module.mounts]] - source = "assets/bootstrap/scss/_vendor" - target = "assets/vendor/bootstrap/scss/vendor" -# mount asserts directory -[[module.mounts]] - source = "assets" - target = "assets" -# mount i18n directory -[[module.mounts]] - source = "i18n" - target = "i18n" -# mount layouts directory -[[module.mounts]] - source = "layouts" - target = "layouts" -# mount static directory -[[module.mounts]] - source = "static" - target = "static" -# Dependencies are brought in as modules -# and mount points are declared -[[module.imports]] - path = "github.com/twbs/bootstrap" - disable = false - ignoreConfig = true -[[module.imports.mounts]] - source = "scss" - target = "assets/vendor/bootstrap/scss" -[[module.imports.mounts]] - source = "dist/js" - target = "assets/vendor/bootstrap/dist/js" -[[module.imports]] - path = "github.com/FortAwesome/Font-Awesome" - disable = false -[[module.imports.mounts]] - source = "scss" - target = "assets/vendor/Font-Awesome/scss" -[[module.imports.mounts]] - source = "webfonts" - target = "static/webfonts" diff --git a/dependencies/go.mod b/dependencies/go.mod deleted file mode 100644 index 23c33c76de..0000000000 --- a/dependencies/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/google/docsy/dependencies - -go 1.12 - -require ( - github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2 // indirect - github.com/twbs/bootstrap v5.2.3+incompatible // indirect -) diff --git a/dependencies/go.sum b/dependencies/go.sum deleted file mode 100644 index 403c1f58cb..0000000000 --- a/dependencies/go.sum +++ /dev/null @@ -1,6 +0,0 @@ -github.com/FortAwesome/Font-Awesome v0.0.0-20230207192303-d02961b01815 h1:IgbtROhk8s9GkcNxrqFKAzR5rmDwV/QQ4Y31pb6crM8= -github.com/FortAwesome/Font-Awesome v0.0.0-20230207192303-d02961b01815/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= -github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2 h1:Uv1z5EqCfmiK4IHUwT0m3h/u/WCk+kpRfxvAZhpC7Gc= -github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= -github.com/twbs/bootstrap v5.2.3+incompatible h1:lOmsJx587qfF7/gE7Vv4FxEofegyJlEACeVV+Mt7cgc= -github.com/twbs/bootstrap v5.2.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= diff --git a/go.mod b/go.mod index 05a07738ca..8dba239114 100644 --- a/go.mod +++ b/go.mod @@ -2,8 +2,9 @@ module github.com/google/docsy go 1.12 +// AUTO-GENERATED using `npm run get:hugo-modules` + require ( - github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2 // indirect - github.com/google/docsy/dependencies v0.7.1 // indirect - github.com/twbs/bootstrap v5.2.3+incompatible // indirect + github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536 // indirect + github.com/twbs/bootstrap v5.3.3+incompatible // indirect ) diff --git a/go.sum b/go.sum index 0ab0330fe6..f95c3b0d76 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,4 @@ -github.com/FortAwesome/Font-Awesome v0.0.0-20230207192303-d02961b01815 h1:IgbtROhk8s9GkcNxrqFKAzR5rmDwV/QQ4Y31pb6crM8= -github.com/FortAwesome/Font-Awesome v0.0.0-20230207192303-d02961b01815/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= -github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2 h1:Uv1z5EqCfmiK4IHUwT0m3h/u/WCk+kpRfxvAZhpC7Gc= -github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= -github.com/google/docsy/dependencies v0.6.1-0.20230125095517-798c2504905e h1:lfvr9ByCkuIz/ARoEDC/6gucVRjkooYTts5P+0yq5Qk= -github.com/google/docsy/dependencies v0.6.1-0.20230125095517-798c2504905e/go.mod h1:qhtpynRkDn1FOmD1gj0a5n6ptDjDw0O4Zmb+6pfYUKU= -github.com/google/docsy/dependencies v0.6.1-0.20230601182954-ff1818261e64 h1:ZBeOh/qGThEUn/r4vPXyfKXYKvMPmHgGS1BgQI8Xf2E= -github.com/google/docsy/dependencies v0.6.1-0.20230601182954-ff1818261e64/go.mod h1:gihhs5gmgeO+wuoay4FwOzob+jYJVyQbNaQOh788lD4= -github.com/twbs/bootstrap v5.2.3+incompatible h1:lOmsJx587qfF7/gE7Vv4FxEofegyJlEACeVV+Mt7cgc= -github.com/twbs/bootstrap v5.2.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= +github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536 h1:LFS9LpoSZYhxQ6clU0NIVbaGR08BlxAs4b+9W+7IGVQ= +github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= +github.com/twbs/bootstrap v5.3.3+incompatible h1:goFoqinzdHfkeegpFP7pvhbd0g+A3O2hbU3XCjuNrEQ= +github.com/twbs/bootstrap v5.3.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= diff --git a/hugo.yaml b/hugo.yaml index a6581d8161..3930bcf3ef 100644 --- a/hugo.yaml +++ b/hugo.yaml @@ -42,3 +42,22 @@ module: target: assets/vendor/Font-Awesome - source: ../../node_modules/@fortawesome/fontawesome-free/webfonts target: static/webfonts + # Mounts for module installations, + # needed to work around a known bug in Go’s module management. + - source: assets/_vendor/bootstrap/scss/ + target: assets/vendor/bootstrap/scss/vendor + imports: + - path: github.com/twbs/bootstrap + disable: false + mounts: + - source: scss + target: assets/vendor/bootstrap/scss + - source: dist/js + target: assets/vendor/bootstrap/dist/js + - path: github.com/FortAwesome/Font-Awesome + disable: false + mounts: + - source: scss + target: assets/vendor/Font-Awesome/scss + - source: webfonts + target: static/webfonts diff --git a/i18n/de.toml b/i18n/de.toml index 665eedf3b3..d64e7b166c 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -79,3 +79,13 @@ other = "Wenn Du aktiv beteiligen und einen Beitrag zu {{ .Site.Title }} leisten other = "Wie Du selbst zu {{ .Site.Title }} beitragen kannst, kannst Du nachlesen in unseren" [community_guideline] other = "Richtlinien für Beiträge" + +# Feedback +[feedback_title] +other = "Rückmeldung" +[feedback_question] +other = "War diese Seite hilfreich?" +[feedback_positive] +other = "Ja" +[feedback_negative] +other = "Nein" diff --git a/i18n/en.toml b/i18n/en.toml index 476b1cd67b..dcb78102c9 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -27,7 +27,6 @@ other = "All Rights Reserved" [footer_privacy_policy] other = "Privacy Policy" - # Post (blog, articles etc.) [post_byline_by] other = "By" @@ -79,3 +78,13 @@ other = "If you want to get more involved by contributing to {{ .Site.Title }}, other = "You can find out how to contribute to {{ .Site.Title }} in our" [community_guideline] other = "Contribution Guidelines" + +# Feedback +[feedback_title] +other = "Feedback" +[feedback_question] +other = "Was this page helpful?" +[feedback_positive] +other = "Yes" +[feedback_negative] +other = "No" diff --git a/i18n/es.toml b/i18n/es.toml index ef6a47adc8..dd84b258b7 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -7,7 +7,7 @@ other = "Previo" other = "Siguiente" [ui_read_more] -other = "Contiuar leyendo" +other = "Continuar leyendo" [ui_search] other = "Buscar" diff --git a/i18n/hi.toml b/i18n/hi.toml new file mode 100644 index 0000000000..84fe407741 --- /dev/null +++ b/i18n/hi.toml @@ -0,0 +1,81 @@ +# UI strings. Buttons and similar. + +[ui_pager_prev] +other = "पिछला" + +[ui_pager_next] +other = "अगला" + +[ui_read_more] +other = "अधिक जानें" + +[ui_search] +other = "इस साइट में खोजें…" + +# Used in sentences such as "Posted in News" +[ui_in] +other = "में" + +# Used in sentences such as "All Tags" +[ui_all] +other = "देखना सभी टैग" + +# Footer text +[footer_all_rights_reserved] +other = "सर्वाधिकार सुरक्षित" + +[footer_privacy_policy] +other = "गोपनीयता नीति" + + +# Post (blog, articles etc.) +[post_byline_by] +other = "द्वारा" +[post_created] +other = "बनाया" +[post_last_mod] +other = "अंतिम बार संशोधित" +[post_edit_this] +other = "इस पृष्ठ को संपादित करें" +[post_view_this] +other = "पृष्ठ का स्त्रोत देखें" +[post_create_child_page] +other = "चाइल्ड पृष्ठ बनाएं" +[post_create_issue] +other = "समस्या की सुचना दें" +[post_create_project_issue] +other = "परियोजना इशू बनाएं" +[post_posts_in] +other = "पोस्ट में" +[post_reading_time] +other = "लघु अध्ययन" +[post_less_than_a_minute_read] +other = "एक मिनट से कम" + +# Print support +[print_printable_section] +other = "यह इस खंड का बहु-पृष्ठ प्रिंट योग्य दृश्य है।" +[print_click_to_print] +other = "प्रिंट करने के लिए यहां क्लिक करें" +[print_show_regular] +other = "इस पृष्ठ के सामान्य दृश्य पर लौटें" +[print_entire_section] +other = "संपूर्ण अनुभाग प्रिंट करें" + +# Community +[community_join] +other = "{{ .Site.Title }} समुदाय में शामिल हों" +[community_introduce] +other = "{{ .Site.Title }} एक खुला स्रोत प्रोजेक्ट है जिसका समुदाय में कोई भी उपयोग कर सकता है, सुधार कर सकता है और आनंद ले सकता है। हम चाहेंगे कि आप हमारे साथ जुड़ें! क्या हो रहा है इसका पता लगाने और इसमें शामिल होने के कुछ तरीके यहां दिए गए हैं." +[community_learn] +other = "सीखें और जुड़ें" +[community_using] +other = "{{ .Site.Title }} का उपयोग कर रहे हैं या करना चाहते हैं? यहां और जानें:" +[community_develop] +other = "विकास करें और योगदान दें" +[community_contribute] +other = "यदि आप {{ .Site.Title }} में योगदान देकर और अधिक शामिल होना चाहते हैं, तो यहां हमसे जुड़ें:" +[community_how_to] +other = "आप हमारे यहां {{ .Site.Title }} में योगदान करने का तरीका जान सकते हैं" +[community_guideline] +other = "योगदान दिशानिर्देश" diff --git a/i18n/ja.toml b/i18n/ja.toml index 74046d9d2d..5c714c9d29 100644 --- a/i18n/ja.toml +++ b/i18n/ja.toml @@ -35,6 +35,8 @@ other = "作成" other = "最終更新" [post_edit_this] other = "ページの編集" +[post_view_this] +other = "ページのソースコードを見る" [post_create_child_page] other = "子ページを作成" [post_create_issue] diff --git a/i18n/pl.toml b/i18n/pl.toml index aa421ef091..eda21d1ce6 100644 --- a/i18n/pl.toml +++ b/i18n/pl.toml @@ -12,7 +12,7 @@ other = "Dalej" other = "Zobacz więcej" [ui_search] -other = "Szukaj ns stronie ..." +other = "Szukaj na stronie ..." # Used in sentences such as "Posted in News" [ui_in] diff --git a/i18n/tr.toml b/i18n/tr.toml index 5a7acb080d..288423cadc 100644 --- a/i18n/tr.toml +++ b/i18n/tr.toml @@ -1,5 +1,3 @@ - - # UI strings. Buttons and similar. [ui_pager_prev] @@ -18,14 +16,17 @@ other = "Bu sitede arayın…" [ui_in] other = "içinde" +# Used in sentences such as "All Tags" +[ui_all] +other = "tüm" + # Footer text [footer_all_rights_reserved] -other = "Bütün haklar saklıdır" +other = "Tüm Hakları Saklıdır" [footer_privacy_policy] other = "Gizlilik Politikası" - # Post (blog, articles etc.) [post_byline_by] other = "by" @@ -35,6 +36,8 @@ other = "Oluşturuldu" other = "Son düzenleme" [post_edit_this] other = "Bu sayfayı düzenle" +[post_view_this] +other = "Sayfa kaynağını görüntüle" [post_create_child_page] other = "Çocuk sayfası oluştur" [post_create_issue] @@ -46,7 +49,7 @@ other = "Gönderiler in" [post_reading_time] other = "minute read" [post_less_than_a_minute_read] -other = "less than a minute" +other = "1 dakikadan az" # Print support [print_printable_section] @@ -60,18 +63,28 @@ other = "Bütün bölümü yazıdırın" # Community [community_join] -other = "Join the {{ .Site.Title }} community" +other = "{{ .Site.Title }} topluluğuna katılın" [community_introduce] -other = "{{ .Site.Title }} is an open source project that anyone in the community can use, improve, and enjoy. We'd love you to join us! Here's a few ways to find out what's happening and get involved." +other = "{{ .Site.Title }} topluluktaki herkesin kullanabileceği, geliştirebileceği ve keyfini çıkarabileceği açık kaynaklı bir projedir. Bize katılmanızı çok isteriz! İşte neler olduğunu öğrenmenin ve dahil olmanın birkaç yolu." [community_learn] -other = "Learn and Connect" +other = "Öğrenin ve Bağlanın" [community_using] -other = "Using or want to use {{ .Site.Title }}? Find out more here:" +other = "{{ .Site.Title }} kullanıyor veya kullanmak mı istiyorsunuz? Daha fazlasını burada bulabilirsiniz:" [community_develop] -other = "Develop and Contribute" +other = "Geliştirin ve Katkıda Bulunun" [community_contribute] other = "If you want to get more involved by contributing to {{ .Site.Title }}, join us here:" [community_how_to] other = "You can find out how to contribute to {{ .Site.Title }} in our" [community_guideline] -other = "Contribution Guidelines" +other = "Katkı Yönergeleri" + +# Feedback +[feedback_title] +other = "Geribildirim" +[feedback_question] +other = "Bu sayfa yararlı oldu mu?" +[feedback_positive] +other = "Evet" +[feedback_negative] +other = "Hayır" diff --git a/i18n/zh-cn.toml b/i18n/zh-cn.toml index f2a2583881..3e7abe370c 100644 --- a/i18n/zh-cn.toml +++ b/i18n/zh-cn.toml @@ -46,7 +46,7 @@ other = "提交文档问题" [post_create_project_issue] other = "提交项目问题" [post_posts_in] -other = "张贴在" +other = "撰写于" [post_reading_time] other = "分钟阅读" [post_less_than_a_minute_read] diff --git a/i18n/zh-tw.toml b/i18n/zh-tw.toml index d6a21ed0e2..80bbff59d2 100644 --- a/i18n/zh-tw.toml +++ b/i18n/zh-tw.toml @@ -7,14 +7,14 @@ other = "上一頁" other = "下一頁" [ui_read_more] -other = "更多" +other = "閱讀全文" [ui_search] -other = "站內搜索…" +other = "站內搜尋…" # Used in sentences such as "Posted in News" [ui_in] -other = "在" +other = "於" # Used in sentences such as "All Tags" [ui_all] @@ -30,7 +30,7 @@ other = "隱私政策" # Post (blog, articles etc.) [post_byline_by] -other = "藉由" +other = "作者:" [post_created] other = "創建" [post_last_mod] @@ -46,21 +46,21 @@ other = "創建文檔議題" [post_create_project_issue] other = "創建項目議題" [post_posts_in] -other = "張貼在" +other = "張貼於" [post_reading_time] -other = "分鐘閱讀" +other = " 分鐘左右可讀完" [post_less_than_a_minute_read] -other = "少於1分鐘" +other = "1 分鐘內可讀完" # Print support [print_printable_section] -other = "這是本節的多頁可打印視圖。" +other = "這是本節的多頁可列印視圖。" [print_click_to_print] -other = "點擊此處打印" +other = "點擊此處列印" [print_show_regular] other = "返回此頁面的常規視圖" [print_entire_section] -other = "打印整個章節" +other = "列印整個章節" # Community [community_join] diff --git a/layouts/_default/_markup/td-render-heading.html b/layouts/_default/_markup/td-render-heading.html new file mode 100644 index 0000000000..9b470cede5 --- /dev/null +++ b/layouts/_default/_markup/td-render-heading.html @@ -0,0 +1,8 @@ + + {{- .Text | safeHTML -}} + {{ template "_default/_markup/_td-heading-self-link.html" . -}} + + +{{- define "_default/_markup/_td-heading-self-link.html" -}} + +{{- end -}} diff --git a/layouts/_default/content.html b/layouts/_default/content.html index 193927abb1..3da0d06c00 100644 --- a/layouts/_default/content.html +++ b/layouts/_default/content.html @@ -8,10 +8,7 @@

{{ .Title }}

{{ end -}} {{ .Content }} - {{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) -}} - {{ partial "feedback.html" .Site.Params.ui.feedback }} -
- {{ end -}} + {{ partial "feedback.html" . -}} {{ if (.Site.Params.DisqusShortname) -}}
{{- partial "disqus-comment.html" . -}} diff --git a/layouts/_internal/google_analytics_gtag.html b/layouts/_internal/google_analytics_gtag.html index 32b6a33654..2c9c7da908 100644 --- a/layouts/_internal/google_analytics_gtag.html +++ b/layouts/_internal/google_analytics_gtag.html @@ -6,19 +6,19 @@ specifically this version: - https://github.com/gohugoio/hugo/blob/f7e00c039ff3cea5f991b05c1e325666004cf129/tpl/tplimpl/embedded/templates/google_analytics.html + https://github.com/gohugoio/hugo/blob/8d32ca223def4031aa26f98e8efc1a8b4e7b7546/tpl/tplimpl/embedded/templates/google_analytics.html The only differences between this copy and the original are that we've dropped: - The `{{ if hasPrefix . "G-"}}` condition - - The `{{ else }}` block + - The `{{ else ... }}` block - The `anonymize_ip` argument to the `gtag()` call, since it is superfluous. For details, see https://github.com/gohugoio/hugo/issues/10093. */}} {{- $pc := .Site.Config.Privacy.GoogleAnalytics -}} -{{- if not $pc.Disable }}{{ with .Site.GoogleAnalytics -}} +{{- if not $pc.Disable }}{{ with .Site.Config.Services.GoogleAnalytics.ID -}} +{{ end -}} +
+{{ end -}} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index b652549f2f..c61969b488 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,46 +1,17 @@ -{{ $links := .Site.Params.links -}} - -{{- define "footer-links-block" }} - -{{ end -}} diff --git a/layouts/partials/footer/center.html b/layouts/partials/footer/center.html new file mode 100644 index 0000000000..a12ada49cf --- /dev/null +++ b/layouts/partials/footer/center.html @@ -0,0 +1,15 @@ +{{ partial "footer/copyright.html" . -}} + +{{ with .Site.Params.privacy_policy -}} + {{ T "footer_privacy_policy" }} +{{- end -}} + +{{ if ne .Site.Params.ui.footer_about_disable nil -}} + {{ warnf "Config parameter '.params.ui.footer_about_disable' is DEPRECATED, use '.params.ui.footer_about_enable' instead." -}} +{{ end -}} + +{{ if or .Site.Params.ui.footer_about_enable (eq .Site.Params.ui.footer_about_disable false) -}} + {{ with .Site.GetPage "about" -}} + + {{- end -}} +{{ end -}} diff --git a/layouts/partials/footer/copyright.html b/layouts/partials/footer/copyright.html new file mode 100644 index 0000000000..8962fb87aa --- /dev/null +++ b/layouts/partials/footer/copyright.html @@ -0,0 +1,41 @@ +{{ $page := .Page -}} +{{ with .Site.Params.copyright -}} + {{ $fromYear := "" -}} + {{ $toYear := "" -}} + {{ $authors := "" -}} + {{ if reflect.IsMap . -}} + {{ $fromYear = .from_year -}} + {{ $toYear = .to_year -}} + {{ $authors = .authors -}} + {{ else -}} + {{ $authors = . -}} + {{ end -}} + + © + {{ with $fromYear -}} + {{ . }}– + {{- end -}} + {{ $toYear | default now.Year }} + + {{- $authors + | default (printf "%s Authors" ($.Site.Title | default "Site")) + | $page.RenderString -}} + + {{- /* Trim WS */ -}} + + + {{- with T "footer_all_rights_reserved" -}} + + {{- . -}} + + {{- end }} + +{{- else -}} + + {{ with .Site.Copyright -}} + + {{- . | $page.RenderString -}} + + {{- end -}} + +{{ end -}} diff --git a/layouts/partials/footer/left.html b/layouts/partials/footer/left.html new file mode 100644 index 0000000000..ed9265f4c2 --- /dev/null +++ b/layouts/partials/footer/left.html @@ -0,0 +1,5 @@ +{{ with .Site.Params.links -}} + {{ with index . "user" -}} + {{- partial "footer/links.html" . -}} + {{ end -}} +{{ end -}} diff --git a/layouts/partials/footer/links.html b/layouts/partials/footer/links.html new file mode 100644 index 0000000000..0d84f4e1dd --- /dev/null +++ b/layouts/partials/footer/links.html @@ -0,0 +1,9 @@ + diff --git a/layouts/partials/footer/right.html b/layouts/partials/footer/right.html new file mode 100644 index 0000000000..3afc3d2744 --- /dev/null +++ b/layouts/partials/footer/right.html @@ -0,0 +1,5 @@ +{{ with .Site.Params.links -}} + {{ with index . "developer" -}} + {{- partial "footer/links.html" . -}} + {{ end -}} +{{ end -}} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 5fb1dd25ca..44eb901593 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,6 +1,5 @@ -{{ hugo.Generator }} {{ range .AlternativeOutputFormats -}} {{ end -}} @@ -27,8 +26,8 @@ {{ template "_internal/twitter_cards.html" . -}} {{ partialCached "head-css.html" . "asdf" -}} {{ if .Site.Params.offlineSearch -}} {{ if $needmhchem -}} {{/* To add support for displaying chemical equations and physical units, load the mhchem extension: */ -}} - {{ end -}} {{/* To automatically render math in text elements, include the auto-render extension: */ -}} - @@ -64,9 +59,7 @@ {{ $jsBs := resources.Get "vendor/bootstrap/dist/js/bootstrap.bundle.js" -}} {{ $jsBase := resources.Get "js/base.js" -}} -{{ $jsAnchor := resources.Get "js/anchor.js" -}} {{ $jsSearch := resources.Get "js/search.js" | resources.ExecuteAsTemplate "js/search.js" .Site.Home -}} -{{ $jsMermaid := resources.Get "js/mermaid.js" | resources.ExecuteAsTemplate "js/mermaid.js" . -}} {{ $jsMarkmap := resources.Get "js/markmap.js" | resources.ExecuteAsTemplate "js/markmap.js" . -}} {{ $jsPlantuml := resources.Get "js/plantuml.js" | resources.ExecuteAsTemplate "js/plantuml.js" . -}} {{ $jsDrawio := resources.Get "js/drawio.js" | resources.ExecuteAsTemplate "js/drawio.js" . -}} @@ -74,11 +67,10 @@ {{ $jsSearch = resources.Get "js/offline-search.js" -}} {{ end -}} -{{ $jsArray := slice $jsBs $jsBase $jsAnchor $jsSearch $jsPlantuml $jsMarkmap $jsDrawio -}} +{{ $jsArray := slice $jsBs $jsBase $jsSearch $jsPlantuml $jsMarkmap $jsDrawio -}} -{{ if $needmermaid -}} -{{ $jsArray = $jsArray | append $jsMermaid -}} - +{{ if .Page.Store.Get "hasmermaid" -}} +{{- partial "scripts/mermaid.html" . -}} {{ end -}} {{ $js := $jsArray | resources.Concat "js/main.js" -}} @@ -101,5 +93,25 @@ crossorigin="anonymous"> {{ end -}} +{{ if and .Site.Params.search (isset .Site.Params.search "algolia") -}} + {{ template "algolia/scripts" .Site.Params.search.algolia -}} +{{ end -}} {{ partial "hooks/body-end.html" . -}} + +{{ define "algolia/scripts" -}} + + +{{ end -}} diff --git a/assets/js/mermaid.js b/layouts/partials/scripts/mermaid.html similarity index 55% rename from assets/js/mermaid.js rename to layouts/partials/scripts/mermaid.html index 6b021d416d..6ea757a8df 100644 --- a/assets/js/mermaid.js +++ b/layouts/partials/scripts/mermaid.html @@ -1,25 +1,26 @@ -(function($) { - var needMermaid = false; +{{ $version := .Site.Params.mermaid.version | default "latest" -}} -{{ if ge hugo.Version "0.93.0" -}} - if ($('.mermaid').length > 0) { - needMermaid = true; - }; +{{ $cdnurl := printf "https://cdn.jsdelivr.net/npm/mermaid@%s/dist/mermaid.esm.min.mjs" $version -}} +{{ with resources.GetRemote $cdnurl -}} + {{ with .Err -}} + {{ errorf "Could not retrieve mermaid script from CDN. Reason: %s." . -}} + {{ end -}} {{ else -}} - $('.language-mermaid').parent().replaceWith(function() { - needMermaid = true; - return $('
').text($(this).text());
-    });
+  {{ errorf "Invalid Mermaid version %s, could not retrieve this version from CDN." $version -}}
 {{ end -}}
 
-    if (!needMermaid)  {
+
diff --git a/layouts/partials/search-input.html b/layouts/partials/search-input.html
index feb1e74460..7817e0abc8 100644
--- a/layouts/partials/search-input.html
+++ b/layouts/partials/search-input.html
@@ -1,11 +1,30 @@
+{{ .Scratch.Set "docsy-search" 0 -}}
+
 {{ if .Site.Params.gcs_engine_id -}}
+{{ .Scratch.Add "docsy-search" 1 -}}
+
 
-{{ else if .Site.Params.algolia_docsearch -}}
-
-{{ else if .Site.Params.offlineSearch -}} + +{{- end -}} + + +{{ if and .Site.Params.search (isset .Site.Params.search "algolia") -}} +{{ .Scratch.Add "docsy-search" 1 -}} +{{ .Scratch.Add "docsearch-id-num" 1 -}} + + + +{{- end -}} + + +{{ if .Site.Params.offlineSearch -}} +{{ .Scratch.Add "docsy-search" 1 -}} + {{ $offlineSearchIndex := resources.Get "json/offline-search-index.json" | resources.ExecuteAsTemplate "offline-search-index.json" . -}} {{ if hugo.IsProduction -}} {{/* Use `md5` as finger print hash function to shorten file name to avoid `file name too long` error. */ -}} @@ -33,4 +52,10 @@ data-offline-search-max-results="{{ .Site.Params.offlineSearchMaxResults | default 10 }}" > + +{{- end -}} + +{{ if gt (.Scratch.Get "docsy-search") 1 -}} +{{ warnf `You have more than one site-search option configured: choose only one. + For details, see https://www.docsy.dev/docs/adding-content/search.` -}} {{ end -}} diff --git a/layouts/partials/section-index.html b/layouts/partials/section-index.html index e1c83154c1..845d5c6148 100644 --- a/layouts/partials/section-index.html +++ b/layouts/partials/section-index.html @@ -1,31 +1,33 @@
- {{ $parent := .Page }} - {{ $pages := (where .Site.Pages "Section" .Section).ByWeight }} + {{ $parent := .Page -}} + {{ $pages := (where .Site.Pages "Section" .Section).ByWeight -}} {{ $pages = (where $pages "Type" "!=" "search") }} - {{ $pages = (where $pages ".Params.hide_summary" "!=" true) }} - {{ $pages = (where $pages ".Parent" "!=" nil) }} - {{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) }} - {{ if or $parent.Params.no_list (eq (len $pages) 0) }} + {{ $pages = (where $pages ".Params.hide_summary" "!=" true) -}} + {{ $pages = (where $pages ".Parent" "!=" nil) -}} + {{ if and .Parent .Parent.File -}} + {{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) -}} + {{ end -}} + {{ if or $parent.Params.no_list (eq (len $pages) 0) -}} {{/* If no_list is true or we don't have subpages we don't show a list of subpages */}} - {{ else if $parent.Params.simple_list }} + {{ else if $parent.Params.simple_list -}} {{/* If simple_list is true we show a bulleted list of subpages */}}
    - {{ range $pages }} + {{ range $pages -}} {{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }}
  • {{- .Title -}}
  • - {{ end }} + {{ end -}}
- {{ else }} + {{ else -}} {{/* Otherwise we show a nice formatted list of subpages with page descriptions */}}
- {{ range $pages }} - {{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }} + {{ range $pages -}} + {{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) -}}
{{- .Title -}}
-

{{ .Description | markdownify }}

+

{{ .Description | markdownify -}}

- {{ end }} - {{ end }} + {{ end -}} + {{ end -}}
diff --git a/layouts/partials/sidebar-tree.html b/layouts/partials/sidebar-tree.html index 60f583c111..2ce0c56373 100644 --- a/layouts/partials/sidebar-tree.html +++ b/layouts/partials/sidebar-tree.html @@ -18,7 +18,10 @@
{{ end -}} -