Skip to content

autodoc example parsing #60

Description

@becky-gilbert

I've just tried out the autodoc command with my new extension package, and it's working well - thanks!!

I noticed that it wasn't automatically parsing my example files and I had to use the start/end sentinels around relevant blocks. It looks like the example extractor will only pick up trial objects that include trial in the variable name (const trialPattern = /^[a-zA-Z_$]*[Tt]rial(_?\d+)?$/;), so it was failing to find anything in my example files that had variable names like fixation, test, countdown etc. I'm wondering if there was a reason for this restriction, or if the parser could pick up any objects in the examples that include a top-level extensions parameter? If you're open to that change, I can test it locally and open a PR.

Edit:

It might also be useful to do a recursive search for the extensions parameter, since the code block extractor missed my example code that had the trial object nested in a timeline node, like this:

// extractor missed this
const trial_restart_after_pause = {
  timeline: [
    {
      type: jsPsychHtmlButtonResponse,
      ... other params ...
      extensions: [ { type: jsPsychExtensionPause } ], // extension is nested
    },
  ],
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions