Skip to content

Commit dd3dc86

Browse files
committed
Roll init filter build
1 parent 251b402 commit dd3dc86

File tree

14 files changed

+1614
-17
lines changed

14 files changed

+1614
-17
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
on:
2+
push:
3+
branches: [main, master]
4+
release:
5+
types: [published]
6+
workflow_dispatch: {}
7+
8+
name: demo-website
9+
10+
jobs:
11+
demo-page:
12+
runs-on: ubuntu-latest
13+
# Only restrict concurrency for non-PR jobs
14+
concurrency:
15+
group: quarto-publish-${{ github.event_name != 'pull_request' || github.run_id }}
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
steps:
21+
22+
- name: "Check out repository"
23+
uses: actions/checkout@v4
24+
25+
# To render using knitr, we need a few more setup steps...
26+
# If we didn't want the examples to use `engine: knitr`, we could
27+
# skip a few of the setup steps.
28+
- name: "Setup R"
29+
uses: r-lib/actions/setup-r@v2
30+
31+
- name: "Setup R dependencies for Quarto's knitr engine"
32+
uses: r-lib/actions/setup-r-dependencies@v2
33+
with:
34+
packages:
35+
any::knitr
36+
any::rmarkdown
37+
any::downlit
38+
any::xml2
39+
any::reticulate
40+
41+
- name: "Set up Quarto"
42+
uses: quarto-dev/quarto-actions/setup@v2
43+
with:
44+
version: "pre-release"
45+
46+
# Render the Quarto file
47+
- name: "Render working directory"
48+
uses: quarto-dev/quarto-actions/render@v2
49+
with:
50+
path: "docs"
51+
52+
53+
# Upload a tar file that will work with GitHub Pages
54+
# Make sure to set a retention day to avoid running into a cap
55+
# This artifact shouldn't be required after deployment onto pages was a success.
56+
- name: Upload Pages artifact
57+
uses: actions/upload-pages-artifact@v3
58+
with:
59+
retention-days: 1
60+
path: 'docs/_site'
61+
62+
63+
# Use an Action deploy to push the artifact onto GitHub Pages
64+
# This requires the `Action` tab being structured to allow for deployment
65+
# instead of using `docs/` or the `gh-pages` branch of the repository
66+
- name: Deploy to GitHub Pages
67+
id: deployment
68+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/.luarc.json
2+
.DS_Store
3+
/docs/_site/
4+
*_files/

README.md

Lines changed: 101 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,109 @@
1-
# Quarto Extension Development with Lua in a Devcontainer
1+
# linkrot <img src="docs/linkrot-animated-logo.svg" align ="right" alt="" width ="150"/>
22

3-
This repository houses a devcontainer that setups a [Quarto extension development environment](https://quarto.org/docs/extensions/lua.html). The container is setup to work with [GitHub Codespaces](https://github.com/features/codespaces) to instantly have a cloud-based developer workflow.
3+
A Quarto extension that automatically checks for broken external links in your documents during rendering.
44

5-
You can try out the Codespace by clicking on the following button:
5+
## Installation
66

7-
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/coatless-devcontainer/quarto-extension-dev?quickstart=1)
7+
To install the `linkrot` Quarto extension, follow these steps:
88

9-
**Note:** Codespaces are available to Students and Teachers for free [up to 180 core hours per month](https://docs.github.com/en/education/manage-coursework-with-github-classroom/integrate-github-classroom-with-an-ide/using-github-codespaces-with-github-classroom#about-github-codespaces) through [GitHub Education](https://education.github.com/). Otherwise, you will have [up to 60 core hours and 15 GB free per month](https://github.com/features/codespaces#pricing).
9+
1. Open your terminal.
10+
2. Execute the following command:
1011

11-
The devcontainer contains:
12+
```sh
13+
quarto add coatless-quarto/linkrot
14+
```
1215

13-
- The latest [pre-release](https://quarto.org/docs/download/prerelease) version of Quarto.
14-
- [Quarto VS Code Extension](https://marketplace.visualstudio.com/items?itemName=quarto.quarto).
15-
- [Lua LSP VS Code Extension](https://marketplace.visualstudio.com/items?itemName=sumneko.lua) for Lua code intelligence.
16-
- [GitHub copilot VS Code Extension](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot).
17-
- `R` and `Python`
18-
- `knitr` and `jupyter`
16+
This command will download and install the Quarto extension under the `_extensions` subdirectory of your Quarto project.
17+
If you are using version control, ensure that you include this directory in your repository.
1918

20-
## References
19+
### Requirements
20+
21+
- Quarto >= 1.7.0
22+
- `curl` command-line tool:
23+
- **Linux/macOS**: Usually pre-installed
24+
- **Windows**: Built-in on Windows 10 (1803+) and Windows 11
25+
- **Older Windows**: Install [curl for Windows](https://curl.se/windows/) or use Git Bash which includes curl
26+
27+
## Usage
28+
29+
Add the extension to your document's YAML header:
30+
31+
```yaml
32+
---
33+
title: "My Document"
34+
filters:
35+
- linkrot
36+
---
37+
```
38+
39+
The extension will automatically check all external HTTP/HTTPS links during rendering and report any broken links.
40+
41+
## Configuration
42+
43+
You can configure linkrot's behavior in your document's YAML using the `extensions.linkrot` key:
44+
45+
```yaml
46+
---
47+
title: "My Document"
48+
filters:
49+
- linkrot
50+
extensions:
51+
linkrot:
52+
fail-on-error: false # Set to true to fail the build if broken links are found
53+
timeout: 10 # Timeout in seconds for each URL check
54+
user-agent: "Quarto-Linkrot/1.0" # User agent string for requests
55+
cache-results: true # Cache results to avoid checking the same URL multiple times
56+
debug: false # Enable debug logging
57+
output-file: null # Write results to a file (e.g., "linkrot-report.txt")
58+
skip-patterns: # List of regex patterns to skip
59+
- "example\\.com"
60+
- "localhost"
61+
---
62+
```
63+
64+
### Configuration Options
65+
66+
#### fail-on-error** (default: `false`)
67+
68+
- If set to `true`, the build will fail if any broken links are detected. Useful for CI/CD pipelines.
69+
70+
#### timeout (default: `10`)
71+
72+
- Maximum time in seconds to wait for each URL to respond.
73+
74+
#### user-agent (default: `"Quarto-Linkrot/1.0"`)
75+
76+
- User agent string sent with HTTP requests.
77+
78+
#### cache-results (default: `true`)
79+
80+
- Cache URL check results to avoid repeatedly checking the same URL in a document.
81+
82+
#### debug (default: `false`)
83+
84+
- Enable debug logging to see detailed information about what linkrot is doing.
85+
86+
#### output-file (default: `null`)
87+
88+
- Path to a file where results will be written. If not specified, results are only shown in the console.
89+
90+
#### skip-patterns
91+
92+
- List of regex patterns. URLs matching any pattern will be skipped (not checked).
93+
94+
## Example Output
95+
96+
When the extension runs, you'll see output like this in the console:
97+
98+
```default
99+
=== Linkrot Results ===
100+
Total external links checked: 15
101+
Broken links found: 2
102+
103+
Broken links:
104+
1. [Example Link] https://example.com/broken-page (Status: 404)
105+
2. [Another Link] https://nonexistent-site-xyz123.com (Status: timeout/error)
106+
```
107+
108+
You can also specify an output file to save the results.
21109

22-
- [Quarto: Lua API Reference](https://quarto.org/docs/extensions/lua-api.html)
23-
- [Quarto: Lua Development](https://quarto.org/docs/extensions/lua.html)
24-
- [Pandoc: Lua Filters](https://pandoc.org/lua-filters.html)
25-
- [Lua: Manual](https://www.lua.org/manual/5.4/)

_extensions/linkrot/_extension.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
title: linkrot
2+
author: James Joseph Balamuta
3+
version: 0.0.0-dev.1
4+
quarto-required: ">=1.7.0"
5+
contributes:
6+
filters:
7+
- linkrot.lua

0 commit comments

Comments
 (0)