Skip to content

Add support for inlining external examples #348

Open
@ianwremmel

Description

@ianwremmel

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).

Activity

tmcw

tmcw commented on Feb 15, 2016

@tmcw
Member

For the time being, it'd certainly be best to do this in a separate step, before documentation.js. I would prefer not to include another interpretation layer on top of JSDoc, especially one that allowed arbitrary paths to be inserted into docs.

anandthakker

anandthakker commented on Feb 16, 2016

@anandthakker
Contributor

Is this something that could be solved by a custom theme?

On Sun, Feb 14, 2016 at 7:45 PM Tom MacWright notifications@github.com
wrote:

For the time being, it'd certainly be best to do this in a separate step,
before documentation.js. I would prefer not to include another
interpretation layer on top of JSDoc, especially one that allowed arbitrary
paths to be inserted into docs.


Reply to this email directly or view it on GitHub
#348 (comment)
.

ianwremmel

ianwremmel commented on Feb 20, 2016

@ianwremmel
Author

Interesting. I've got it working with a grunt task, but I like the idea of using a theme instead. Are there any examples out there of extending the default theme?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @tmcw@ianwremmel@anandthakker

        Issue actions

          Add support for inlining external examples · Issue #348 · documentationjs/documentation