val-town-docs icon indicating copy to clipboard operation
val-town-docs copied to clipboard

Code blocks that allow to open them in Val Town should specify the type of a Val

Open Xkonti opened this issue 2 years ago • 1 comments

Let's say there's a code block that presents how to create an API using Hono:

```ts val
import ...
// Do other stuff
```

If user will click "Open in Val Town" the new Val won't be of type HTML introducing more friction and probably confusing some new users.

Solution proposal

If supported in val.town/new it could be achieved by appropriately marking code blocks with meta:

  • val - the existing marking would create regular script vals
  • val-script - explicitly specifies a script val
  • val-http - explicitly specifies http val
  • val-cron - scheduled val
  • val-email - email val

It would be really easy to extract that info in the current code block processor and pass to the URL.

Xkonti avatar Dec 08 '23 22:12 Xkonti

Excellent idea!!!

stevekrouse avatar Dec 08 '23 23:12 stevekrouse