petebacondarwin / dgeni-angular

Apache License 2.0
55 stars 25 forks source link

Using the ngdoc standard and outputting to Markdown? #7

Open gavD opened 8 years ago

gavD commented 8 years ago

Hello,

I want to to document my code with the ngdoc standard to generate documentation in markdown. Is this possible or am I completely off the reservation?

I tried and failed to implement this in my own project. I started off with your dgeni-angular project as a template and gradually added my code. This seemed to output bare bones HTML, which was a good start, but as soon as I switched from jsdoc to ndcoc it stopped outputting anything:

var path = require('canonical-path');
var Package = require('dgeni').Package;

module.exports = new Package('app', [
  require('dgeni-packages/angularjs'),
  require('dgeni-packages/jsdoc'), // fails if I remove this line
  require('dgeni-packages/ngdoc'), // fails if I have this line
  require('dgeni-packages/nunjucks')
])
.config(function(log, readFilesProcessor, writeFilesProcessor) {
  log.level = 'info';
  readFilesProcessor.basePath = path.resolve(__dirname, '..');
  readFilesProcessor.sourceFiles = [
    { include: 'src/**/*.js', basePath: 'src' }
  ];
  writeFilesProcessor.outputFolder  = 'build';
})
.config(function(templateFinder, templateEngine) {
  templateEngine.config.tags = {
    variableStart: '{$',
    variableEnd: '$}'
  };

  templateFinder.templateFolders
      .unshift(path.resolve(__dirname, 'templates'));

  templateFinder.templatePatterns = [
    '${ doc.template }',
    '${ doc.id }.${ doc.docType }.template.html',
    '${ doc.id }.template.html',
    '${ doc.docType }.template.html',
    'common.template.html'
  ];
})
.config(function(getLinkInfo) {
  getLinkInfo.relativeLinks = true;
});

I note that there is a dgeni-markdown module but I could not get this working.

I could write my own templates but I feel like it's an awful lot of work when all I really want is "basically JavaDoc, but outputting to Markdown".

I feel like I'm flailing around, could you perhaps point me in the right direction? I can't afford to burn much more time trying to get documentation generation up and running.

Thanks,