Skip to content

Commit

Permalink
Add docs website
Browse files Browse the repository at this point in the history
  • Loading branch information
coatless committed Apr 28, 2024
1 parent f2e5e3c commit 1ded5b7
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/publish-website.yml
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
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.quarto/
1 change: 1 addition & 0 deletions docs/_extensions
24 changes: 24 additions & 0 deletions docs/_quarto.yml
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
74 changes: 74 additions & 0 deletions docs/index.qmd
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)
```
17 changes: 17 additions & 0 deletions docs/qoptions-release-notes.qmd
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.

0 comments on commit 1ded5b7

Please sign in to comment.