Skip to content

Commit

Permalink
chore: update docs to be accurate
Browse files Browse the repository at this point in the history
  • Loading branch information
nperez0111 committed Nov 8, 2024
1 parent f203dd5 commit e3331f1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/content/editor/extensions/marks/link.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ Link.configure({
})
```

### default protocol
### defaultProtocol

The default protocol used by `linkOnPaste` and `autolink` when no protocol is defined.

By default, the href generated for example.com is http://example.com and this option allows that protocol to be customized.
Expand Down Expand Up @@ -144,7 +145,7 @@ Link.configure({
})
```

### validate
### isAllowedUri

A function that allows customization of link validation, modifying the default verification logic. This function accepts the URL and a context object with additional properties.

Expand All @@ -161,12 +162,16 @@ A function that allows customization of link validation, modifying the default v
This function enables you to enforce rules on allowed protocols or domains when autolinking URLs.

```js
// Validate URLs to only accept specific protocols
// Validate URLs to only accept non-relative URLs
Link.configure({
validate: (url, ctx) => ctx.defaultValidate(url) && !url.startsWith('./'),
isAllowedUri: (url, ctx) => ctx.defaultValidate(url) && !url.startsWith('./'),
})
```

### validate (deprecated)

This function has been deprecated in favor of the more descriptive `shouldAutoLink` function. If provided, the `validate` function will replace the `shouldAutoLink` function.

### shouldAutoLink

Defines whether a valid link should be automatically linked within the editor content.
Expand Down

0 comments on commit e3331f1

Please sign in to comment.