1

I am building a site, and I would like to have my documentation built into the site.

For example if I use JSDoc to generate documentation for javascript, I get the auto generated files, I can just change the template to only output the content.

I would like to generate WordPress pages for these automatically.

I have a custom post type which is component, so I would like for it to work something like this:

component/component-name/docs/0.0.0/page-name

I could manually do this but there are a bunch of components and it would be easier to have each release have the documentation automatically incorporated in.


EDIT

some of the things I have in mind:

Idea 1 ) Add extra args to the url, and a folder with the docs. Pull the html off of the folder and display on page. Essentially using it like a pseudo rest api

  • Pros: don't have to deal with generating pages, docs show latest upload automatically.

  • Cons: Not searchable inside WordPress

Idea 2 ) Have a script which traverses all the files in a docs folder and programmatically generates pages.

  • Pros: Searchable within WordPress

  • Cons: Probably have to delete and regenerate pages if making a change, most likely also going to be a pain in the ass.

If anyone knows how WordPress does their own codex site and can point me in the direction of something that can be large scale but mostly automated that would be extremely nice.

2
  • While I think I understand what you're wanting to do, your question leaves out a lot of detail about how you want to do this. Perhaps you can edit in what you've come up with so far as possible options to explore, to give us something to go on?
    – Tim Malone
    Aug 16, 2016 at 23:38
  • Sorry, added some more info. Aug 16, 2016 at 23:54

1 Answer 1

2

WordPress allows you to add help tabs which appear in your Dashboard and on each admin page.

$screen = get_current_screen();

$screen->add_help_tab( array( 

   'id' => $id,            //unique id for the tab
   'title' => $title,      //unique visible title for the tab
   'content' => $content,  //actual help text
   'callback' => $callback //optional function to callback

) );

APIGen or PHPDoc can help create your PHP documentation from your DockBlocks and render as HTML.

There are other various plugins like WP Help and Documentor that might help.

But it's almost like you want a living style guide like this or this.

Your best bet is to stick with help tabs and link to your auto-generated pages elsewhere -- or do your docs as a book.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.