docsonnet icon indicating copy to clipboard operation
docsonnet copied to clipboard

docsonnet not finding nested doc-strings

Open nabadger opened this issue 5 years ago • 0 comments

Hi,

Would you be able to confirm whether this is expected to work?

I find that any object/function under new() does not get picked up by docsonnet , i.e. there's no inside_object - was hoping it would also get rendered into markdown :)

local d = import 'doc-util/main.libsonnet';
{
  // package declaration
  '#': d.pkg(
    name='myapp',
    url='...',
    help='`myapp` implements a ...',
  ),

  '#outside_object': d.obj('This works and docsonnet renders it'),
  outside_object+:: {
    foo: {},
  },

  '#new':: d.fn(help='new returns an instance of myapp',
                args=[
                  d.arg(name='config', type=d.T.string),
                  d.arg(name='name', type=d.T.string),
                ]),

  new(config, name)::
    {
      '#inside_object': d.obj('This does not get rendered by docsonnet'),
      inside_object+:: {
        foo: {},
      },
    },
}

renders to


permalink: /

package myapp

local myapp = import "..."

myapp implements a ...

Index

  • fn new(config, name)
  • obj outside_object

Fields

fn new

new(config, name)

new returns an instance of myapp

obj outside_object

This works and docsonnet renders it

nabadger avatar Sep 16 '20 07:09 nabadger