import { denoTag } from "https://deno.land/x/deno_tag@v1.1.0/code.ts";
The main function of deno-tag, it does three things:
- Looks for
<deno>
tags on the supplied text and reads their attributes - Runs
deno
for each found<deno>
tag - Creates a new text where each
<deno>
tag is replaced by the output of its respective run (from the previous point)
Finally it returns this new changed text.
There are two supported attributes for the <deno>
tag:
<deno bundle="someCode.ts" />
- Replaces the tag with the output from running the
options.bundler
someCode.ts
(by default theoptions.bundler
isDeno.bundler
)
- Replaces the tag with the output from running the
<deno run="someCode.ts" />
- Replaces the tag with the console output from running
options.runner
onsomeCode.ts
(by default theoptions.runner
isDeno.run
)
- Replaces the tag with the console output from running
It assumes that the file path can be found from Deno.cwd
. (see cli.ts
)
The file paths passed on the <deno>
are relative to the location of the
file that holds the <deno>
tag.
Note: Padding is preserved, the output is set on the text at the same
indentation level that the respective <deno>
tag is written at.
Parameters
optional
options: DenoTagOptions