如何在html模板中处理javascript代码(jsdoc / grunt-jsdoc)

时间:2016-03-14 23:13:26

标签: gruntjs jsdoc jsdoc3

jsdoc没有解析<script>内容(有效的JSDOC注释的有效JS)。

如何解决?

甚至可以在脚本标签内扫描html文件和文档代码吗?

jsdoc: {
      dist: {
        src: ['assets/js/**/*.js', 'templates/users/*.html', 'README.md'],
        options: {
          destination: '.dev/jsdoc',
          template: 'node_modules/ink-docstrap/template',
          configure: '.jsdoc.conf.json'
        }
      }
    },

.jsdoc.conf.json

{
  "tags": {
    "allowUnknownTags": true
  },
  "plugins": ["plugins/markdown"],
  "templates": {
    "logoFile": "",
    "cleverLinks": false,
    "monospaceLinks": false,
    "dateFormat": "ddd MMM Do YYYY",
    "outputSourceFiles": true,
    "outputSourcePath": true,
    "systemName": "Django",
    "footer": "",
    "copyright": "DocStrap Copyright © 2012-2015 The contributors to the JSDoc3 and DocStrap projects.",
    "navType": "vertical",
    "theme": "readable",
    "linenums": true,
    "collapseSymbols": false,
    "inverseNav": true,
    "protocol": "html://",
    "methodHeadingReturns": false
  },
  "markdown": {
    "parser": "gfm",
    "hardwrap": true
  },
  "opts": {
    "sort": false
  }
}

1 个答案:

答案 0 :(得分:1)

如果你看一下这个问题:https://github.com/jsdoc3/jsdoc/issues/721 jsdoc不支持此功能。但是,有一个插件可以在拉取请求中实现解析HTML文件:https://github.com/jsdoc3/jsdoc/pull/723