From 74e960f654c83e1860470f5fcf79c8b92595d43c Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Thu, 19 Nov 2026 17:04:50 -0800 Subject: [PATCH 1/3] docs: link to docs by relative file path instead of full URLs --- .remarkrc.mjs | 11 ++++++++++- CONTRIBUTING.md | 2 +- docs/angular/overlays.mdx | 14 +++++++------- docs/api/input.mdx | 2 +- docs/api/select.mdx | 2 +- docs/api/textarea.mdx | 2 +- docs/react/overlays.mdx | 18 +++++++++--------- docs/reference/glossary.mdx | 2 +- docs/updating/7-0.mdx | 6 +++--- 9 files changed, 34 insertions(+), 25 deletions(-) diff --git a/.remarkrc.mjs b/.remarkrc.mjs index 318f269cc3..9e16548b74 100644 --- a/.remarkrc.mjs +++ b/.remarkrc.mjs @@ -10,6 +10,10 @@ import remarkFrontmatter from 'remark-frontmatter'; // Schemes such as https: and mailto:, in-page anchors, and protocol-relative URLs. const NOT_A_PAGE_LINK = /^([a-z][a-z\d+.-]*:|#|\/\/)/i; +// A page on this site by its full URL. Archived versions such as `/docs/v3/` +// are not built from this repo, so they stay full URLs. +const DOCS_SITE_URL = /^https?:\/\/(www\.)?ionicframework\.com\/docs(?!\/v\d+(\/|$))(\/|$|[?#])/i; + const pathOf = (url) => url.split(/[?#]/)[0]; /** @@ -17,7 +21,9 @@ const pathOf = (url) => url.split(/[?#]/)[0]; * such as `./accordion.mdx`. Docusaurus resolves it to the page in the same * version and fails the build if the file is missing, and editors can follow * it. Without the extension it is a URL that Docusaurus cannot map to a file, - * and a leading `/` is read from the repo root by editors and GitHub. + * and a leading `/` is read from the repo root by editors and GitHub. A full + * `ionicframework.com/docs` URL always opens the current version, so a reader + * on an older version lands on the wrong page. * * A JSX `href` or `to` never goes through that resolver, so it must be an * absolute URL path without the extension, such as `/api/accordion`. A relative @@ -25,6 +31,9 @@ const pathOf = (url) => url.split(/[?#]/)[0]; * one without the version prefix, such as `/v8/`, leads to the current docs. */ const checkMarkdownLink = (url) => { + if (DOCS_SITE_URL.test(url) && !/\.[a-z\d]+$/i.test(pathOf(url).replace(/\/$/, ''))) { + return `Link to \`${url}\` by the doc's relative file path, such as \`../api/modal.mdx\`. A full URL always opens the current version.`; + } if (url === '' || NOT_A_PAGE_LINK.test(url)) return null; const path = pathOf(url); if (/\.mdx?$/.test(path)) { diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a12dabdee8..11e1bb8d65 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -231,7 +231,7 @@ Use Markdown for links and headings whenever possible. When you need JSX, such a - [``](https://docusaurus.io/docs/docusaurus-core#link) from `@docusaurus/Link` instead of ``. It handles the base URL and locale, and opens external URLs in a new tab with `rel="noopener noreferrer"`. - [``](https://docusaurus.io/docs/api/misc/@docusaurus/eslint-plugin/prefer-docusaurus-heading) from `@theme/Heading` instead of `

` to `

`. -Link to another doc by its relative file path, with the extension, such as `[Accordion](./accordion.mdx)` or `[Config](../developing/config.mdx)`. Docusaurus resolves it to the page in the same version, the build fails if the file doesn't exist, and editors can follow it to the file. A JSX prop such as `href` skips that step, so use the URL path without `/docs` or an extension instead: `/api/accordion`, or `/v8/api/accordion` on a v8 page. `npm run lint` flags a link in either form that doesn't follow this. +Link to another doc by its relative file path, with the extension, such as `[Accordion](./accordion.mdx)` or `[Config](../developing/config.mdx)`. Docusaurus resolves it to the page in the same version, the build fails if the file doesn't exist, and editors can follow it to the file. Don't link to a doc by its full `ionicframework.com/docs` URL, which always opens the current version. A JSX prop such as `href` skips that step, so use the URL path without `/docs` or an extension instead: `/api/accordion`, or `/v8/api/accordion` on a v8 page. `npm run lint` flags a link in either form that doesn't follow this. The build only checks links and anchors that go through Markdown or these components. A raw `` to a page that doesn't exist builds without errors, and a raw heading's `id` can't be used as a link target. diff --git a/docs/angular/overlays.mdx b/docs/angular/overlays.mdx index 6ceacd67cf..90efbc66be 100644 --- a/docs/angular/overlays.mdx +++ b/docs/angular/overlays.mdx @@ -213,10 +213,10 @@ import type { ModalOptions, PopoverOptions } from '@ionic/angular'; For full docs and usage examples, visit the docs page for each of the overlays in Ionic: -- [Action Sheet](https://ionicframework.com/docs/api/action-sheet) -- [Alert](https://ionicframework.com/docs/api/alert) -- [Loading](https://ionicframework.com/docs/api/loading) -- [Modal](https://ionicframework.com/docs/api/modal) -- [Picker](https://ionicframework.com/docs/api/picker) -- [Popover](https://ionicframework.com/docs/api/popover) -- [Toast](https://ionicframework.com/docs/api/toast) +- [Action Sheet](../api/action-sheet.mdx) +- [Alert](../api/alert.mdx) +- [Loading](../api/loading.mdx) +- [Modal](../api/modal.mdx) +- [Picker](../api/picker.mdx) +- [Popover](../api/popover.mdx) +- [Toast](../api/toast.mdx) diff --git a/docs/api/input.mdx b/docs/api/input.mdx index f59116838c..5190ef20d6 100644 --- a/docs/api/input.mdx +++ b/docs/api/input.mdx @@ -156,7 +156,7 @@ Note that this feature is considered experimental because it relies on a simulat :::note -In most cases, [Icon](./icon.mdx) components placed in these slots should have `aria-hidden="true"`. Refer to the [Icon accessibility docs](https://ionicframework.com/docs/api/icon#accessibility) for more information. +In most cases, [Icon](./icon.mdx) components placed in these slots should have `aria-hidden="true"`. Refer to the [Icon accessibility docs](./icon.mdx#accessibility) for more information. If slot content is meant to be interacted with, it should be wrapped in an interactive element such as a [Button](./button.mdx). This ensures that the content can be tabbed to. diff --git a/docs/api/select.mdx b/docs/api/select.mdx index 943a0f25f6..865422fa3d 100644 --- a/docs/api/select.mdx +++ b/docs/api/select.mdx @@ -192,7 +192,7 @@ The `start` and `end` slots can be used to place icons, buttons, or prefix/suffi :::note -In most cases, [Icon](./icon.mdx) components placed in these slots should have `aria-hidden="true"`. Refer to the [Icon accessibility docs](https://ionicframework.com/docs/api/icon#accessibility) for more information. +In most cases, [Icon](./icon.mdx) components placed in these slots should have `aria-hidden="true"`. Refer to the [Icon accessibility docs](./icon.mdx#accessibility) for more information. If slot content is meant to be interacted with, it should be wrapped in an interactive element such as a [Button](./button.mdx). This ensures that the content can be tabbed to. diff --git a/docs/api/textarea.mdx b/docs/api/textarea.mdx index 1bdf193aa7..49dd5c3b4c 100644 --- a/docs/api/textarea.mdx +++ b/docs/api/textarea.mdx @@ -122,7 +122,7 @@ Note that this feature is considered experimental because it relies on a simulat :::note -In most cases, [Icon](./icon.mdx) components placed in these slots should have `aria-hidden="true"`. Refer to the [Icon accessibility docs](https://ionicframework.com/docs/api/icon#accessibility) for more information. +In most cases, [Icon](./icon.mdx) components placed in these slots should have `aria-hidden="true"`. Refer to the [Icon accessibility docs](./icon.mdx#accessibility) for more information. If slot content is meant to be interacted with, it should be wrapped in an interactive element such as a [Button](./button.mdx). This ensures that the content can be tabbed to. diff --git a/docs/react/overlays.mdx b/docs/react/overlays.mdx index f601e75f4c..3a69cbaf21 100644 --- a/docs/react/overlays.mdx +++ b/docs/react/overlays.mdx @@ -49,7 +49,7 @@ showAlert({ }); ``` -Overlay hooks that display additional custom components as part of their markup, such as [modals](https://ionicframework.com/docs/api/modal) and [popovers](https://ionicframework.com/docs/api/popover), take in a couple of additional parameters when initializing their hooks. The first parameter is the component you want your overlay to display, and the second is an object of additional props you want to pass into the component when it gets constructed: +Overlay hooks that display additional custom components as part of their markup, such as [modals](../api/modal.mdx) and [popovers](../api/popover.mdx), take in a couple of additional parameters when initializing their hooks. The first parameter is the component you want your overlay to display, and the second is an object of additional props you want to pass into the component when it gets constructed: ```tsx const [present, dismiss] = useIonModal(({ name }: { name: string }) =>
Hello {name}.
, { @@ -79,7 +79,7 @@ Above, the `showAlert` boolean is a piece of state provided from your applicatio When the overlay is dismissed, it is important to tie into the `onDidDismiss` callback and set your state variable to indicate that the overlay is no longer presenting. Ionic React looks for changes to the `isOpen` prop to determine if the overlay should be displayed or not. -For overlays that display custom components, such as [modals](https://ionicframework.com/docs/api/modal) and [popovers](https://ionicframework.com/docs/api/popover), you provide the component as a child to the overlay component: +For overlays that display custom components, such as [modals](../api/modal.mdx) and [popovers](../api/popover.mdx), you provide the component as a child to the overlay component: ```tsx @@ -97,10 +97,10 @@ The Overlay Components are still a valid way of displaying overlays and are in n For full docs and usage examples for both the hook and component approach, visit the docs page for each of the overlays in Ionic: -- [Action Sheet](https://ionicframework.com/docs/api/action-sheet) -- [Alert](https://ionicframework.com/docs/api/alert) -- [Loading](https://ionicframework.com/docs/api/loading) -- [Modal](https://ionicframework.com/docs/api/modal) -- [Picker](https://ionicframework.com/docs/api/picker) -- [Popover](https://ionicframework.com/docs/api/popover) -- [Toast](https://ionicframework.com/docs/api/toast) +- [Action Sheet](../api/action-sheet.mdx) +- [Alert](../api/alert.mdx) +- [Loading](../api/loading.mdx) +- [Modal](../api/modal.mdx) +- [Picker](../api/picker.mdx) +- [Popover](../api/popover.mdx) +- [Toast](../api/toast.mdx) diff --git a/docs/reference/glossary.mdx b/docs/reference/glossary.mdx index dfe7382be9..c26044b51b 100644 --- a/docs/reference/glossary.mdx +++ b/docs/reference/glossary.mdx @@ -39,7 +39,7 @@ Bundling is the process of taking an app's dependencies (code you've written plu ## CLI {/* #cli */} -A CLI, or **C**ommand-**L**ine **I**nterface, is a text-based interface for interacting with a program. The common command-line app for a Mac user is the Terminal app, and Windows users often use Command Prompt. The Ionic community often uses this term to refer to [Ionic's CLI](https://ionicframework.com/docs/cli). Ionic's CLI can be used for a number of things, such as creating production builds of an app, running the development server, and accessing [Ionic commercial services](https://ionic.io/appflow). +A CLI, or **C**ommand-**L**ine **I**nterface, is a text-based interface for interacting with a program. The common command-line app for a Mac user is the Terminal app, and Windows users often use Command Prompt. The Ionic community often uses this term to refer to [Ionic's CLI](../cli.mdx). Ionic's CLI can be used for a number of things, such as creating production builds of an app, running the development server, and accessing [Ionic commercial services](https://ionic.io/appflow). {/* cspell:enable */} diff --git a/docs/updating/7-0.mdx b/docs/updating/7-0.mdx index 0a100cf73a..e363acfd23 100644 --- a/docs/updating/7-0.mdx +++ b/docs/updating/7-0.mdx @@ -114,7 +114,7 @@ iOS >=14 ### Modal {/* #modal */} -1. Remove any usage of the `swipeToClose` property. Card modals are swipeable by default, so you can remove `swipeToClose` if you want your card modal to remain swipeable. Use the [canDismiss](https://ionicframework.com/docs/api/modal#preventing-a-modal-from-dismissing) property if you want to prevent a modal from dismissing. +1. Remove any usage of the `swipeToClose` property. Card modals are swipeable by default, so you can remove `swipeToClose` if you want your card modal to remain swipeable. Use the [canDismiss](../api/modal.mdx#preventing-a-modal-from-dismissing) property if you want to prevent a modal from dismissing. 2. Remove any code that sets the `canDismiss` property to `undefined`. The `canDismiss` property now defaults to `true`, so this code is no longer needed. ### Picker {/* #picker */} @@ -133,7 +133,7 @@ iOS >=14 1. Remove `ion-slides`, `ion-slide`, and any associated types. These components have been removed in favor of using Swiper.js directly. The guides below contain more information about this migration: -[Angular Migration Guide](https://ionicframework.com/docs/angular/slides)
[React Migration Guide](https://ionicframework.com/docs/react/slides)
[Vue Migration Guide](https://ionicframework.com/docs/vue/slides) +[Angular Migration Guide](../angular/slides.mdx)
[React Migration Guide](../react/slides.mdx)
[Vue Migration Guide](../vue/slides.mdx) ### Textarea {/* #textarea */} @@ -147,7 +147,7 @@ iOS >=14 1. Remove `ion-virtual-scroll` and any associated types. This component has been removed in favor of using virtual scroll solutions provided by JavaScript Frameworks. The guides below contain more information about this migration: -[Angular Migration Guide](https://ionicframework.com/docs/angular/virtual-scroll)
[React Migration Guide](https://ionicframework.com/docs/react/virtual-scroll)
[Vue Migration Guide](https://ionicframework.com/docs/vue/virtual-scroll) +[Angular Migration Guide](../angular/virtual-scroll.mdx)
[React Migration Guide](../react/virtual-scroll.mdx)
[Vue Migration Guide](../vue/virtual-scroll.mdx) ## Need Help Upgrading? {/* #need-help-upgrading */} From be510c60fcb023bc74193699aab23d43544bdfd7 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Fri, 20 Nov 2026 10:12:57 -0800 Subject: [PATCH 2/3] docs(contributing): note the full URL lint only checks Markdown links --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 11e1bb8d65..4444ba006a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -231,7 +231,7 @@ Use Markdown for links and headings whenever possible. When you need JSX, such a - [``](https://docusaurus.io/docs/docusaurus-core#link) from `@docusaurus/Link` instead of `
`. It handles the base URL and locale, and opens external URLs in a new tab with `rel="noopener noreferrer"`. - [``](https://docusaurus.io/docs/api/misc/@docusaurus/eslint-plugin/prefer-docusaurus-heading) from `@theme/Heading` instead of `

` to `

`. -Link to another doc by its relative file path, with the extension, such as `[Accordion](./accordion.mdx)` or `[Config](../developing/config.mdx)`. Docusaurus resolves it to the page in the same version, the build fails if the file doesn't exist, and editors can follow it to the file. Don't link to a doc by its full `ionicframework.com/docs` URL, which always opens the current version. A JSX prop such as `href` skips that step, so use the URL path without `/docs` or an extension instead: `/api/accordion`, or `/v8/api/accordion` on a v8 page. `npm run lint` flags a link in either form that doesn't follow this. +Link to another doc by its relative file path, with the extension, such as `[Accordion](./accordion.mdx)` or `[Config](../developing/config.mdx)`. Docusaurus resolves it to the page in the same version, the build fails if the file doesn't exist, and editors can follow it to the file. A JSX prop such as `href` skips that step, so use the URL path without `/docs` or an extension instead: `/api/accordion`, or `/v8/api/accordion` on a v8 page. In either form, don't link to a doc by its full `ionicframework.com/docs` URL, which always opens the current version. `npm run lint` flags a link that doesn't follow this, though it only catches a full URL in a Markdown link. The build only checks links and anchors that go through Markdown or these components. A raw `` to a page that doesn't exist builds without errors, and a raw heading's `id` can't be used as a link target. From 22d7a7d44d6ac316b11a5cdeb4bd49839320cc14 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Fri, 20 Nov 2026 10:12:57 -0800 Subject: [PATCH 3/3] chore(lint): allow versioned docs URLs with a query or hash --- .remarkrc.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.remarkrc.mjs b/.remarkrc.mjs index 9e16548b74..cd939f2f88 100644 --- a/.remarkrc.mjs +++ b/.remarkrc.mjs @@ -10,9 +10,9 @@ import remarkFrontmatter from 'remark-frontmatter'; // Schemes such as https: and mailto:, in-page anchors, and protocol-relative URLs. const NOT_A_PAGE_LINK = /^([a-z][a-z\d+.-]*:|#|\/\/)/i; -// A page on this site by its full URL. Archived versions such as `/docs/v3/` -// are not built from this repo, so they stay full URLs. -const DOCS_SITE_URL = /^https?:\/\/(www\.)?ionicframework\.com\/docs(?!\/v\d+(\/|$))(\/|$|[?#])/i; +// A page on this site by its full URL. A versioned URL such as `/docs/v3/` or +// `/docs/v8/` opens that version rather than the current one, so it is allowed. +const DOCS_SITE_URL = /^https?:\/\/(www\.)?ionicframework\.com\/docs(?!\/v\d+(\/|$|[?#]))(\/|$|[?#])/i; const pathOf = (url) => url.split(/[?#]/)[0];