@@ -197,26 +197,21 @@ fn render_help() -> String {
197
197
198
198
format ! (
199
199
"\
200
- Render the given code as an image.
200
+ Render Typst code as an image.
201
201
202
202
Syntax: `?render [pagesize=<page size>] [theme=<theme>] <code block> [...]`
203
203
204
204
**Flags**
205
-
206
205
- `pagesize` can be `preview` (default), `auto`, or `default`.
207
-
208
206
- `theme` can be `dark` (default), `light`, or `transparent`.
209
207
210
208
To be clear, the full default preamble is:
211
-
212
209
```
213
210
{default_preamble}
214
211
```
215
-
216
212
To remove the preamble entirely, use `pagesize=default theme=transparent`.
217
213
218
214
**Examples**
219
-
220
215
```
221
216
?render `hello, world!`
222
217
@@ -288,7 +283,6 @@ impl<'a> poise::PopArgument<'a> for Rest {
288
283
}
289
284
}
290
285
291
- /// Render Typst code as an image.
292
286
#[ poise:: command(
293
287
prefix_command,
294
288
track_edits,
@@ -299,11 +293,9 @@ impl<'a> poise::PopArgument<'a> for Rest {
299
293
) ]
300
294
async fn render (
301
295
ctx : Context < ' _ > ,
302
- #[ description = "Flags" ] flags : RenderFlags ,
303
- #[ description = "Code to render" ] code : CodeBlock ,
304
- #[ rename = "rest" ]
305
- #[ description = "Extra message content" ]
306
- _: Rest ,
296
+ flags : RenderFlags ,
297
+ code : CodeBlock ,
298
+ #[ rename = "rest" ] _: Rest ,
307
299
) -> Result < ( ) , PoiseError > {
308
300
let pool = & ctx. data ( ) . pool ;
309
301
@@ -384,6 +376,13 @@ async fn help(
384
376
ctx : Context < ' _ > ,
385
377
#[ description = "Specific command to show help about" ] command : Option < String > ,
386
378
) -> Result < ( ) , PoiseError > {
379
+ // Avoid the useless parameter list from `poise::builtins::help`.
380
+ if command. as_deref ( ) == Some ( "render" ) {
381
+ // We prefer `reply` but `poise::builtins::help` uses `say`, so be consistent.
382
+ ctx. say ( format ! ( "`?render`\n \n {}" , render_help( ) ) ) . await ?;
383
+ return Ok ( ( ) ) ;
384
+ }
385
+
387
386
let config = poise:: builtins:: HelpConfiguration {
388
387
extra_text_at_bottom : "\
389
388
Type ?help command for more info on a command.
0 commit comments