Skip to content

autodoc --example with multiple example files #61

Description

@becky-gilbert

The example code extraction works for me now after loosening the search criteria (see #60), but I found that it would only generate an example section from a single file in the output doc.

It looks like the reason is that it was using the raw title string (e.g. jsPsychExtensionPause Example) as the title for all example files, and since these are not unique, each example was overwriting the same section. Since the example info already tracks the unique file name and adds it to the generated section title (e.g. jsPsychExtensionPause Example (examples/restart_trial_after_pause.html)), I got around this problem by (1) moving the title into ExampleInfo, (2) using the file path rather than title as the unique key, and (3) updating the renderer to use ### example.title (${example.path}) for the heading. Let me know what you think and if you want this in a PR.

Also, a tiny suggestion: Maybe we could have some way of setting the example title directly in each file, e.g. // jspsych-autodoc:title My title.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions