1

I'm creating docs using ng-router in non-html5 mode. All links should be converted to href="#!/path". By default tag {@link} creates href="path".

Is ths behaviour configurable?

QwiglyDee
  • 789
  • 8
  • 18

1 Answers1

1

What i've found is, that ngdoc is using link filter.

You can override that filter with 2 simple steps.

Create a file (./filters/link.js) with the following content:

var _ = require('lodash');

    module.exports = function() {
      return {
        name: 'link',
        process: function(url, title, doc) {
          return _.template('{@link ${url} ${title} }')({ url: '#!/'+url, title: title });
        }
      };
    };

After you have to register (override) it. In your dgeni configuration file put this:

...
.config(function(templateEngine, getInjectables) {

  templateEngine.filters = templateEngine.filters.concat(getInjectables([
    require('./filters/link')
  ]));

})
...

This will register a new filter under the name link. Since it's running after ngdoc configuration, it will override existing link filter.

Hope it helps.

DDRamone
  • 1,078
  • 11
  • 18