#Is there a way to get the result of deno doc in an uncolored version.

29 messages · Page 1 of 1 (latest)

unborn moth
#

Whenever I do deno doc file I get a colored version as usual. But if I have this code:

const p = Deno.run({
  cmd: ["deno","doc","file"],
  stdout: "piped"
});

const out = await p.output();

It keeps the colored version as it should. The issue is if I want to write the result to a file like:

const p = Deno.run({
  cmd: ["deno","doc","file"],
  stdout: "piped"
});

const uint8 = new TextEncoder().encode(await p.output());

Deno.writeFile("output",uint8);

I get a file that looks a little like:

wary cradle
unborn moth
#

what?

#

i want to write a readable version of the result of deno doc to a file, thats the issue

#

sorry if my question wasnt very clear

#

but i need to remove the colors to make it readable

#

i guess i could do something with regex and replacement

wary cradle
#

Shell redirection should do

unborn moth
#

yea deno doc --json is cool

round onyx
#

@unborn moth you can set the NO_COLOR env var

unborn moth
unborn moth
#

i fixed it but im using regex to remove the color

unborn moth
unborn moth
real scaffold
#

yes

#

deno doc overall does only do exports afaik

unborn moth
#

yea i knew that

#

i thought json would be different

real scaffold
#

It is not

unborn moth
#

aight ty

unborn moth
real scaffold
#

not familiar with any, no. I recommend you take a look at the source code for https://doc.deno.land

Dynamically generate documentation for your code. Running on Deno Deploy.

unborn moth
#

aight ty

unborn moth
#

oh nice

#

aight imma close this thing