Skip to content

Commit

Permalink
Update dead links in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Thavarshan committed Sep 30, 2024
1 parent 8a1b38a commit 15b6392
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 3 deletions.
49 changes: 49 additions & 0 deletions docs/api-examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
outline: deep
---

# Runtime API Examples

This page demonstrates usage of some of the runtime APIs provided by VitePress.

The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:

```md
<script setup>
import { useData } from 'vitepress'

const { theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>
```

<script setup>
import { useData } from 'vitepress'

const { site, theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>

## More

Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).
6 changes: 3 additions & 3 deletions docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ Learn more about response handling in the [Response API](./response.md).

FetchPHP enables asynchronous HTTP requests using PHP Fibers, providing true concurrency. The `async()` function allows you to perform non-blocking requests while handling the results using `.then()` and `.catch()` for success and error scenarios. You can also manage the lifecycle of asynchronous tasks, including pausing, resuming, canceling, and retrying tasks.

Explore the [Async API](./async-requests.md) for details on making asynchronous requests.
Explore the [Async API](https://fetch-php.thavarshan.com/guide/async-requests.md) for details on making asynchronous requests.

### **Task Lifecycle Management**

For asynchronous tasks, FetchPHP provides control mechanisms to manage long-running processes or tasks. The `Task` class, powered by the Matrix package, allows you to start, pause, resume, cancel, and retry tasks, making it ideal for handling asynchronous workflows that require fine-grained control.

Refer to the [Task Management API](./task-management.md) for more information.
Refer to the [Task Management API](https://github.com/Thavarshan/matrix) for more information.

### Error Handling

FetchPHP offers robust error-handling mechanisms for both synchronous and asynchronous requests. You can manage exceptions using `try/catch` blocks, disable automatic HTTP error exceptions, and implement custom retry logic for failed requests.

Detailed information can be found in the [Error Handling API](./error-handling.md).
Detailed information can be found in the [Error Handling API](https://fetch-php.thavarshan.com/guide/error-handling.md).
85 changes: 85 additions & 0 deletions docs/markdown-examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Markdown Extension Examples

This page demonstrates some of the built-in markdown extensions provided by VitePress.

## Syntax Highlighting

VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:

**Input**

````md
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````

**Output**

```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```

## Custom Containers

**Input**

```md
::: info
This is an info box.
:::

::: tip
This is a tip.
:::

::: warning
This is a warning.
:::

::: danger
This is a dangerous warning.
:::

::: details
This is a details block.
:::
```

**Output**

::: info
This is an info box.
:::

::: tip
This is a tip.
:::

::: warning
This is a warning.
:::

::: danger
This is a dangerous warning.
:::

::: details
This is a details block.
:::

## More

Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).

0 comments on commit 15b6392

Please sign in to comment.