Skip to content

Add support for inlining external examples #348

Open
@ianwremmel

Description

This probably shouldn't be scoped to just @example, but that's my specific use case.

Basically, I've written examples in my source code comments, but as a result, I can't unit test them, lint them, etc, so they tend to have typos and whatnot.

src/constructable.js

/**
 * @example
 * <%= examples/constructable.js %>
 */
class Constructable {

}

examples/constructable.js

var constructed = new Constructable()
assert.instanceOf(constructed, Constructable);

which would produce the same output as

/**
 * @example
 * var constructed = new Constructable()
 * assert.instanceOf(constructed, Constructable);
 */
class Constructable {

}

Right now, my plan is to solve this with a mix of documentationjs and grunt templating, but it would be great to see something like this natively in documentationjs (or via a plugin, if #70 gets traction).

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions