Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .remarkrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,30 @@ 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. 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];

/**
* A Markdown link to a doc must be its relative file path with the extension,
* 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
* one resolves against the page's URL instead, and on an older version's page
* 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)) {
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ Use Markdown for links and headings whenever possible. When you need JSX, such a
- [`<Link>`](https://docusaurus.io/docs/docusaurus-core#link) from `@docusaurus/Link` instead of `<a>`. It handles the base URL and locale, and opens external URLs in a new tab with `rel="noopener noreferrer"`.
- [`<Heading>`](https://docusaurus.io/docs/api/misc/@docusaurus/eslint-plugin/prefer-docusaurus-heading) from `@theme/Heading` instead of `<h2>` to `<h6>`.

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. 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 `<a href>` to a page that doesn't exist builds without errors, and a raw heading's `id` can't be used as a link target.

Expand Down
14 changes: 7 additions & 7 deletions docs/angular/overlays.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion docs/api/input.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion docs/api/select.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion docs/api/textarea.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
18 changes: 9 additions & 9 deletions docs/react/overlays.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => <div>Hello {name}.</div>, {
Expand Down Expand Up @@ -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
<IonModal isOpen={showModal}>
Expand All @@ -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)
2 changes: 1 addition & 1 deletion docs/reference/glossary.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 */}

Expand Down
6 changes: 3 additions & 3 deletions docs/updating/7-0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 */}
Expand All @@ -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)<br /> [React Migration Guide](https://ionicframework.com/docs/react/slides)<br /> [Vue Migration Guide](https://ionicframework.com/docs/vue/slides)
[Angular Migration Guide](../angular/slides.mdx)<br /> [React Migration Guide](../react/slides.mdx)<br /> [Vue Migration Guide](../vue/slides.mdx)

### Textarea {/* #textarea */}

Expand All @@ -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)<br /> [React Migration Guide](https://ionicframework.com/docs/react/virtual-scroll)<br /> [Vue Migration Guide](https://ionicframework.com/docs/vue/virtual-scroll)
[Angular Migration Guide](../angular/virtual-scroll.mdx)<br /> [React Migration Guide](../react/virtual-scroll.mdx)<br /> [Vue Migration Guide](../vue/virtual-scroll.mdx)

## Need Help Upgrading? {/* #need-help-upgrading */}

Expand Down
Loading