generated from coatless-devcontainer/quarto-extension-dev
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
on: | ||
push: | ||
branches: [main, master] | ||
release: | ||
types: [published] | ||
workflow_dispatch: {} | ||
|
||
name: demo-website | ||
|
||
jobs: | ||
demo-page: | ||
runs-on: ubuntu-latest | ||
# Only restrict concurrency for non-PR jobs | ||
concurrency: | ||
group: quarto-publish-${{ github.event_name != 'pull_request' || github.run_id }} | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: "Check out repository" | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Set up Quarto" | ||
uses: quarto-dev/quarto-actions/setup@v2 | ||
with: | ||
version: "pre-release" | ||
|
||
- name: Publish to GitHub Pages (and render) | ||
uses: quarto-dev/quarto-actions/publish@v2 | ||
with: | ||
target: gh-pages | ||
path: docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/.quarto/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../_extensions/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
project: | ||
type: website | ||
|
||
website: | ||
title: "options" | ||
reader-mode: true | ||
repo-url: https://github.com/coatless-quarto/options/ | ||
repo-actions: [edit, issue] | ||
sidebar: | ||
style: "floating" | ||
search: true | ||
tools: | ||
- icon: github | ||
href: https://github.com/coatless-quarto/options/ | ||
contents: | ||
- text: "Home" | ||
file: index.qmd | ||
- section: "Extra" | ||
contents: | ||
- qoptions-release-notes.qmd | ||
|
||
format: | ||
html: | ||
toc: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
title: "Home" | ||
format: | ||
html: | ||
toc: false | ||
--- | ||
|
||
The `options` Quarto extension allows developers to craft options that incorporate default parameters. | ||
|
||
## Usage | ||
|
||
The `options` extension does not introduce significant enhancements to your document's content. Instead, it serves as a way for authors to quickly bootstrap their own custom code cell through an [extension embedding](https://quarto.org/docs/journals/formats.html#extension-embedding). | ||
|
||
## Installation | ||
|
||
To install the `options` extension inside of your own extension, follow these steps: | ||
|
||
1. Open your terminal. | ||
|
||
2. Navigate to where your own extension's development location is. | ||
|
||
3. Execute the following command: | ||
|
||
```sh | ||
quarto add coatless-quarto/options --embed <your-extension-name> | ||
``` | ||
|
||
This command will download and install the extension under the `_extensions` subdirectory of your Quarto extension project. If you are using version control, ensure that you include this directory in your repository. | ||
|
||
### File structure | ||
|
||
When embedding the extension inside of your own extension, you should see the following folder structure: | ||
|
||
```sh | ||
. | ||
└── _extensions | ||
└── <your-extension-name> | ||
└── _extensions | ||
└── coatless-quarto | ||
└── options | ||
|
||
``` | ||
|
||
### Registering the extension | ||
|
||
Inside of the `_extension.yml`, please include the nested extension under `filters` as the first extension to run: | ||
|
||
``` | ||
title: My Extension | ||
author: My Name | ||
version: 0.1.1 | ||
quarto-required: ">=1.4.549" | ||
contributes: | ||
format: | ||
common: | ||
filters: | ||
- coatless-quarto/options | ||
- <your-extension>.lua | ||
``` | ||
|
||
## Retrieving Options | ||
|
||
Inside of the Lua filter, this extension can be used to setup: | ||
|
||
```lua | ||
-- Store function calls in a table value | ||
local options = require("_extensions.coatless-quarto.options.options") | ||
|
||
-- Attempt to retrieve option | ||
options.tryOption(options, key) | ||
|
||
-- Retrieve option if present, otherwise use default | ||
options.getOption(options, key, default) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
title: "Release Notes" | ||
date: "04-27-2024" | ||
date-modified: last-modified | ||
engine: markdown | ||
format: | ||
html: | ||
toc: true | ||
--- | ||
|
||
# 0.0.0-dev.1: ???? (??-??-????) | ||
|
||
## Features | ||
|
||
- `options` focuses on option tooling for Quarto extension developers: | ||
- `tryOption`: attempts to retrieve the option, otherwise returns `nil`. | ||
- `getOption`: retrieve the current value of the option or fall back to a default value if not found. |