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

标签 gruntjs jsdoc jsdoc3

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

如何解决?

是否可以扫描 script 标签内的 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
  }
}

最佳答案

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

关于gruntjs - 如何处理 html 模板中的 javascript 代码 (jsdoc/grunt-jsdoc),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35999832/

相关文章:

javascript - JSDoc:属性名称

javascript - JSHint 和 grunt.js - Highcharts 未定义

angularjs - 在 Angular 中包含 fontawesome 和 grunt

javascript - 如何使用 ngdoc 记录一个以 Angular 返回类的工厂?

javascript - JSDoc 3 如何读取带有#include 的.c 或.h 文件? (#为非法字符)

javascript - 使用 JsDoc3 创建 AngularJS 文档时出现问题

requirejs - 将带有日期/时间的 'banner"添加到 RequireJS 优化的文件中

javascript - 如何遍历数组并运行 Grunt 任务,将数组中的每个值作为 Grunt 选项传递

javascript - 在 JSDoc 中为内联匿名函数定义参数

documentation-generation - 你如何在 jsDoc 的名称/事件/回调中包含一个点?