docsonnet icon indicating copy to clipboard operation
docsonnet copied to clipboard

feat: use backticks to emphasize names

Open ghostsquad opened this issue 5 years ago • 8 comments

current:

fn container.array

### fn container.array

suggested:

fn container.array

### fn `container.array`

ghostsquad avatar Jul 15 '20 05:07 ghostsquad

This project generates Markdown – so the whole Markdown syntax set is available ;)

tombrk avatar Jul 15 '20 08:07 tombrk

Yep! I wanted to file an issue to see what you thought of the suggestion. Happy to submit a PR if you agree

ghostsquad avatar Jul 15 '20 15:07 ghostsquad

Oh right, this is about the generated part, not the one taken from Jsonnet. Misunderstood while reading on mobile.

After all, I tried to mimic what godoc does, and it does not use <code> there. If this is for a reason, I don't know. Personally, I like the current style, also because monospaced fonts tend to steal more focus from the eye than needed here.

I'd rather suggest making them <a> links, which also highlights them in color and makes it easier to link to html sections. WDYT?

tombrk avatar Jul 16 '20 11:07 tombrk

Color would be great! What would it link to?

ghostsquad avatar Jul 16 '20 15:07 ghostsquad

It GoDoc, it links back to the source code. And although I would love that, I think it wouldn't totally make sense here, unless the user specified the URL (relative) to use due to the lazy evaluation of jsonnet.

Likely though, that's going to be hard to maintain for users.

ghostsquad avatar Jul 16 '20 16:07 ghostsquad

For starters, it could link to the respective html permalink, even though source code would be super awesome

tombrk avatar Jul 16 '20 16:07 tombrk

std.thisFile returns the full path to jsonnet file being evaluated.

❯ jsonnet ~/tmp/test.jsonnet
{
   "filename": "/Users/wmcnamee/tmp/test.jsonnet"
}

Some light testing indicates that you cannot do this for the user though (e.g. put std.thisFile within a function, and somehow find the callers file).

ghostsquad avatar Jul 16 '20 16:07 ghostsquad

you might be able to do some magic with though if the user provided the library with the filename.

d.fn(filename=std.thisFile)

then work out where the root of the repo is, and strip out everything lower than the repo root.

ghostsquad avatar Jul 16 '20 16:07 ghostsquad