You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 extracts code blocks from your documents and splits them by programming language into separate, executable script files.
4
4
5
-
You can try out the Codespace by clicking on the following button:
5
+
## Installation
6
6
7
-
[](https://codespaces.new/coatless-devcontainer/quarto-extension-dev?quickstart=1)
7
+
To install the `ripper` Quarto extension, follow these steps:
8
8
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:
10
11
11
-
The devcontainer contains:
12
+
```sh
13
+
quarto add coatless-quarto/ripper
14
+
```
12
15
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. If you are using version control, ensure that you include this directory in your repository.
19
17
20
-
## References
18
+
## Usage
19
+
20
+
Add the `ripper` filter to your document's YAML front matter:
21
+
22
+
````md
23
+
---
24
+
title: "My Analysis"
25
+
filters:
26
+
- ripper
27
+
---
28
+
29
+
```{r}
30
+
data <- mtcars
31
+
summary(data)
32
+
```
33
+
34
+
```{python}
35
+
import pandas as pd
36
+
df = pd.DataFrame({"x": [1, 2, 3]})
37
+
```
38
+
````
39
+
40
+
Render your document with Quarto:
41
+
42
+
```bash
43
+
quarto render my-analysis.qmd
44
+
```
45
+
46
+
Extracted scripts will be created in the same directory with names based on your document file name, e.g.
47
+
48
+
-`my-analysis.R` - All R code extracted
49
+
-`my-analysis.py` - All Python code extracted
50
+
51
+
---
52
+
53
+
## Configuration
54
+
55
+
Ripper supports a single global option called `include-yaml` under `extensions.ripper`:
56
+
57
+
```yaml
58
+
---
59
+
filters:
60
+
- ripper
61
+
extensions:
62
+
ripper:
63
+
include-yaml: false # Include YAML as comments (default: true)
64
+
---
65
+
```
66
+
67
+
### Option: `include-yaml`
68
+
69
+
-**`true` (default)**: Includes YAML frontmatter as commented lines at the top of each script
70
+
-**`false`**: Extracts only code with no YAML comments
71
+
72
+
## Supported Languages
73
+
74
+
16 languages supported with appropriate file extensions and comment styles:
75
+
76
+
| Language | Extension | Comment |
77
+
|------------|-----------|---------|
78
+
| R | .R | #' |
79
+
| Python | .py | #' |
80
+
| Julia | .jl | #' |
81
+
| Bash | .sh | #' |
82
+
| JavaScript | .js | //' |
83
+
| TypeScript | .ts | //' |
84
+
| SQL | .sql | --' |
85
+
| Rust | .rs | //' |
86
+
| Go | .go | //' |
87
+
| C++ | .cpp | //' |
88
+
| C | .c | //' |
89
+
| Java | .java | //' |
90
+
| Scala | .scala | //' |
91
+
| Ruby | .rb | #' |
92
+
| Perl | .pl | #' |
93
+
| PHP | .php | //' |
21
94
22
-
-[Quarto: Lua API Reference](https://quarto.org/docs/extensions/lua-api.html)
0 commit comments