From 1ded5b7850aee8e90ee0d2022cb265b21629099a Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Sun, 28 Apr 2024 12:50:40 -0700 Subject: [PATCH] Add docs website --- .github/workflows/publish-website.yml | 31 +++++++++++ docs/.gitignore | 1 + docs/_extensions | 1 + docs/_quarto.yml | 24 +++++++++ docs/index.qmd | 74 +++++++++++++++++++++++++++ docs/qoptions-release-notes.qmd | 17 ++++++ 6 files changed, 148 insertions(+) create mode 100644 .github/workflows/publish-website.yml create mode 100644 docs/.gitignore create mode 120000 docs/_extensions create mode 100644 docs/_quarto.yml create mode 100644 docs/index.qmd create mode 100644 docs/qoptions-release-notes.qmd diff --git a/.github/workflows/publish-website.yml b/.github/workflows/publish-website.yml new file mode 100644 index 0000000..a4a7881 --- /dev/null +++ b/.github/workflows/publish-website.yml @@ -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 \ No newline at end of file diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..075b254 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +/.quarto/ diff --git a/docs/_extensions b/docs/_extensions new file mode 120000 index 0000000..3bc7f12 --- /dev/null +++ b/docs/_extensions @@ -0,0 +1 @@ +../_extensions/ \ No newline at end of file diff --git a/docs/_quarto.yml b/docs/_quarto.yml new file mode 100644 index 0000000..e9f2a9a --- /dev/null +++ b/docs/_quarto.yml @@ -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 diff --git a/docs/index.qmd b/docs/index.qmd new file mode 100644 index 0000000..903db14 --- /dev/null +++ b/docs/index.qmd @@ -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 +``` + +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 + └── + └── _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 + - .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) +``` diff --git a/docs/qoptions-release-notes.qmd b/docs/qoptions-release-notes.qmd new file mode 100644 index 0000000..c4b3abe --- /dev/null +++ b/docs/qoptions-release-notes.qmd @@ -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. \ No newline at end of file