Skip to content

Commit 852e46f

Browse files
committed
Roll out v0.0.1
1 parent 19b6782 commit 852e46f

12 files changed

Lines changed: 1082 additions & 178 deletions

README.md

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,22 @@ Extracted scripts will be created in the same directory with names based on your
4848
- `my-analysis.R` - All R code extracted
4949
- `my-analysis.py` - All Python code extracted
5050

51-
---
5251

5352
## Configuration
5453

55-
Ripper supports a single global option called `include-yaml` under `extensions.ripper`:
54+
Ripper supports multiple global options under `extensions.ripper`:
5655

5756
```yaml
5857
---
58+
echo: true # Required to include code blocks in output
5959
filters:
6060
- ripper
6161
extensions:
6262
ripper:
63-
include-yaml: false # Include YAML as comments (default: true)
63+
include-yaml: true # Include YAML as comments (default: true)
64+
script-links-position: "bottom" # Position of links section (default: "bottom")
65+
output-name: "my-scripts" # Custom base name for output files (optional)
66+
debug: false # Enable verbose logging (default: false)
6467
---
6568
```
6669

@@ -69,6 +72,56 @@ extensions:
6972
- **`true` (default)**: Includes YAML frontmatter as commented lines at the top of each script
7073
- **`false`**: Extracts only code with no YAML comments
7174

75+
### Option: `script-links-position`
76+
77+
Controls where the "Script file(s)" section with links to generated scripts appears:
78+
79+
- **`"bottom"` (default)**: Places the section at the end of the document
80+
- **`"top"`**: Places the section at the beginning of the document
81+
- **`"custom"`**: Places the section where you define a div with `id="ripper-links"` in your document
82+
- **`"none"`**: Suppresses the section entirely
83+
84+
#### Custom Positioning Example
85+
86+
- To place the section at a specific location in your document, use `script-links-position: "custom"` and add a div with the id `ripper-links`.
87+
88+
````md
89+
---
90+
title: "My Analysis"
91+
filters:
92+
- ripper
93+
extensions:
94+
ripper:
95+
script-links-position: "custom"
96+
---
97+
98+
## Introduction
99+
100+
Some introductory text here.
101+
102+
::: {#ripper-links}
103+
:::
104+
105+
## Analysis
106+
107+
```{{r}}
108+
# Your code here
109+
```
110+
````
111+
112+
113+
### Option: `output-name`
114+
115+
- Allows you to specify a custom base name for the generated script files instead of using the document name.
116+
- For example, if you set `output-name: "my-custom-name"`, rendering `my-analysis.qmd` would produce:
117+
- `my-custom-name.R`
118+
- `my-custom-name.py`
119+
120+
### Option: `debug`
121+
122+
- Enables verbose logging to help troubleshoot issues or understand the extension's behavior.
123+
124+
72125
## Supported Languages
73126

74127
16 languages supported with appropriate file extensions and comment styles:
@@ -92,3 +145,16 @@ extensions:
92145
| Perl | .pl | #' |
93146
| PHP | .php | //' |
94147

148+
## See Also
149+
150+
### Related Quarto Extensions
151+
152+
1. **[sorting-hat](https://github.com/coatless-quarto/sorting-hat)**: Conditionally retain or omit code blocks by language in rendered documents.
153+
- Use with ripper to control what appears in your document while extracting all visible code to scripts.
154+
2. **[regurgitate](https://github.com/coatless-quarto/regurgitate)**: Automatically create code appendices in your rendered document, organized by language or document order.
155+
- Complements ripper by providing in-document code listings while ripper creates external executable files.
156+
157+
### Historical Context
158+
159+
Ripper's ability to extract code from Quarto documents originated a feature request I submitted in
160+
[`quarto-dev/quarto-cli` issue #1156](https://github.com/quarto-dev/quarto-cli/issues/1156) back on June 14, 2022.

_extensions/ripper/_extension.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
title: Ripper
22
author: James Joseph Balamuta
3-
version: 0.0.0-dev.1
3+
version: 0.0.1
44
quarto-required: ">=1.7.0"
55
contributes:
66
filters:

0 commit comments

Comments
 (0)