|
| 1 | +# Usage Examples |
| 2 | + |
| 3 | +## Basic Conversion |
| 4 | + |
| 5 | +**User** |
| 6 | + |
| 7 | +```bash |
| 8 | +/convert-plaintext-to-md #file |
| 9 | +``` |
| 10 | + |
| 11 | +**Agent** |
| 12 | + |
| 13 | +``` |
| 14 | +I see there is no corresponding `file.md`. Let me copy the plaintext document: |
| 15 | +
|
| 16 | + ```bash |
| 17 | + cp file file.md |
| 18 | + ``` |
| 19 | +
|
| 20 | +Now I'll apply markdown best practices to convert the plaintext documentation to a markdown document. |
| 21 | +``` |
| 22 | + |
| 23 | +--- |
| 24 | + |
| 25 | +## Guide-Based Conversion |
| 26 | + |
| 27 | +Uses a previously converted markdown file as a formatting reference. |
| 28 | + |
| 29 | +**User** |
| 30 | + |
| 31 | +```bash |
| 32 | +/convert-plaintext-to-md #file.md --guide #CODE.md |
| 33 | +``` |
| 34 | + |
| 35 | +**Agent** |
| 36 | + |
| 37 | +``` |
| 38 | +I see that both the file and CODE markdown files have corresponding plaintext documentation. Let me |
| 39 | +check CODE and compare it to CODE.md, and identify patterns to help with conversion. |
| 40 | +
|
| 41 | + CODE |
| 42 | + ```text |
| 43 | + Title |
| 44 | +
|
| 45 | + Text in opening. |
| 46 | +
|
| 47 | + 1. Section |
| 48 | + 1.1 Section Item |
| 49 | +
|
| 50 | + ============================================= |
| 51 | +
|
| 52 | + 1. Section |
| 53 | + 1.1 |
| 54 | + Full details of section item. |
| 55 | + ``` |
| 56 | +
|
| 57 | +And looking at CODE.md: |
| 58 | +
|
| 59 | + CODE.md |
| 60 | + ```markdown |
| 61 | + # Title |
| 62 | +
|
| 63 | + Text in opening. |
| 64 | +
|
| 65 | + ### [Section](#1-section) |
| 66 | +
|
| 67 | + - [1.1](#11) Section Item but Only Numbers in Sub-heading |
| 68 | +
|
| 69 | + *** |
| 70 | +
|
| 71 | + ## 1. Section |
| 72 | +
|
| 73 | + ### 1.1 |
| 74 | +
|
| 75 | + Full details of section item. |
| 76 | + ``` |
| 77 | +
|
| 78 | +I see file.md exists and matches the text in file. |
| 79 | +
|
| 80 | +I'll convert file.md similarly. Let's look at the file text documentation: |
| 81 | +
|
| 82 | + file |
| 83 | + ```text |
| 84 | + Title |
| 85 | +
|
| 86 | + 1. Command |
| 87 | + 1.10.0 Options |
| 88 | +
|
| 89 | + --------------------------------------------- |
| 90 | +
|
| 91 | + Command |
| 92 | + 1.10.0 |
| 93 | + Info on the commands' options. |
| 94 | + ``` |
| 95 | +
|
| 96 | +OK, after analyzing the guide file, I've updated file.md to: |
| 97 | +
|
| 98 | + file.md |
| 99 | + ```markdown |
| 100 | + # Title |
| 101 | +
|
| 102 | + ### [1. Command](#command) |
| 103 | + - [1.10.0](#1100-option-with-text-subheading) Option With Text Subheading |
| 104 | +
|
| 105 | + *** |
| 106 | +
|
| 107 | + ## Command |
| 108 | +
|
| 109 | + ### 1.10.0 Option With Text Subheading |
| 110 | + Info on the commands' options. |
| 111 | + ``` |
| 112 | +``` |
| 113 | + |
| 114 | +--- |
| 115 | + |
| 116 | +## Finalize / Polish |
| 117 | + |
| 118 | +Natural language variations like "polish", "clean up", or "finalize" all trigger the `finalize` behavior. |
| 119 | + |
| 120 | +**User** |
| 121 | + |
| 122 | +```bash |
| 123 | +/convert-plaintext-to-md #file.md polish the converted markdown file |
| 124 | +``` |
| 125 | + |
| 126 | +**Agent** |
| 127 | + |
| 128 | +``` |
| 129 | +I'll finalize file.md. I see the current converted markdown file has: |
| 130 | +
|
| 131 | + ```markdown |
| 132 | + # Title |
| 133 | +
|
| 134 | + Some paragraph with space character at start of line. This <html> should be escaped. |
| 135 | +
|
| 136 | + - Some list item with extra space character. |
| 137 | + - Nested list but only one nesting space character, and extra space after dash. |
| 138 | + if (a == 1) { |
| 139 | + return "Indented code block without enough space characters."; |
| 140 | + } else { |
| 141 | + return "Passing `finalize` or similar should resolve this."; |
| 142 | + } |
| 143 | +
|
| 144 | + But when `python` is used, syntax will be like: |
| 145 | + ``` |
| 146 | +
|
| 147 | + ``` |
| 148 | + import math |
| 149 | + radius = float(input("This is clearly python, but let's do math.")) |
| 150 | + area = math.pi * radius**2 |
| 151 | + circumference = 2 * math.pi * radius |
| 152 | + print(f"Area: {area:.2f}, Circumference: {circumference:.2f}") |
| 153 | + ``` |
| 154 | +
|
| 155 | +Let me trim a few things: |
| 156 | +
|
| 157 | + ```markdown |
| 158 | + # Title |
| 159 | +
|
| 160 | + Some paragraph with space character at start of line. This \<html\> should be escaped. |
| 161 | +
|
| 162 | + - Some list item with extra space character. |
| 163 | + - Nested list but only one space character. |
| 164 | +
|
| 165 | + if (a == 1) { |
| 166 | + return "Indented code block without enough space characters."; |
| 167 | + } else { |
| 168 | + return "Passing `finalize` or similar should resolve this."; |
| 169 | + } |
| 170 | +
|
| 171 | + But when `python` is used, syntax will be like: |
| 172 | +
|
| 173 | + ```python |
| 174 | + import math |
| 175 | + radius = float(input("This is clearly python, but let's do math.")) |
| 176 | + area = math.pi * radius**2 |
| 177 | + circumference = 2 * math.pi * radius |
| 178 | + print(f"Area: {area:.2f}, Circumference: {circumference:.2f}") |
| 179 | + ``` |
| 180 | +``` |
| 181 | + |
| 182 | +--- |
| 183 | + |
| 184 | +## Inline Pattern with Shorthand Regex |
| 185 | + |
| 186 | +**User** |
| 187 | + |
| 188 | +```bash |
| 189 | +/convert-plaintext-to-md #BUGS --p "regex()=> ^ {1,}([0-9]+\.[0-9]+\.[0-9]+) to ^### $1" |
| 190 | +``` |
| 191 | + |
| 192 | +**Agent** |
| 193 | + |
| 194 | +``` |
| 195 | +I see that there is no `BUGS.md` file. Let me copy the current plaintext BUGS documentation: |
| 196 | +
|
| 197 | + ```bash |
| 198 | + copy BUGS BUGS.md |
| 199 | + ``` |
| 200 | +
|
| 201 | +Now I'll update the copied file BUGS.md, converting it to proper markdown. |
| 202 | +Let me read the current contents: |
| 203 | +
|
| 204 | + ```markdown |
| 205 | + 1 Section |
| 206 | + 1.1 Section Item |
| 207 | + 1.2 Section Item |
| 208 | + ... |
| 209 | + 1.12 Section Item |
| 210 | + ``` |
| 211 | +
|
| 212 | +OK, I've matched the shorthand regular expression pattern and updated the BUGS.md to: |
| 213 | +
|
| 214 | + ```markdown |
| 215 | + 1 Section |
| 216 | + ### 1.1 Section Item |
| 217 | + ### 1.2 Section Item |
| 218 | + ### ... |
| 219 | + ### 1.12 Section Item |
| 220 | + ``` |
| 221 | +``` |
0 commit comments