默认“主页” JSDoc的文本和内容 [英] Default "Home" text and content for JSDoc

查看:358
本文介绍了默认“主页” JSDoc的文本和内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从Node.js运行基本JSDoc编译/渲染后:

  jsdoc file1.js file2.js 

我使用目录out中的默认模板获得格式良好的文档。几乎所有都是预期的!



但是当打开文档时,它总是在index.html页面上显示Home,在该初始页面上没有内容,并且侧边栏导航中的主页。



我如何以及在何处注明项目名称以取代主页?我还想看一个项目描述,以及作者和版权信息。



这似乎是JSDoc中最基本的事情,但我可以找不到信息!我根据我在互联网上发现的一些随机文章尝试了以下内容:

  / ** 
*这个JavaScript文件包含foo bar baz ...
*
* @projectname项目名称
* @version 0.1
* @author Greg Pettit
* @copyright 2015
*
* /

但我没有爱。





发现@file / @fileOverview / @overview(所有同义词)指令,这有点帮助我现在可以为每个文件描述和设置版权/作者信息:

  / ** 
* @file Project描述在单个文件名下面呈现,因此不是真正的概述模糊。
*
* @version 0.1
* @author Greg Pettit
* @copyright 2015
*
* /

仍有2个问题需要解决:


  1. 概述说明;我认为@file可以满足我的大多数需求,但由于它是每个文件,我仍然希望在包含文件的描述之前出现一个介绍类型段落或概述段落。


  2. 用自定义文本替换Home文本



解决方案

生成主页



创建降价文件README.md



生成jsdoc:

  $ jsdoc path / to / js path / to / readme / README.md 

要了解有关此次访问的更多信息,请访问官方文档



更改'主页'文字



我不认为这是一种正确的方法,但这样做如果您在工作目录中的项目查找模板文件中安装了jsdoc,我的是:

  ./ node_modules / jsdoc / templates / default / publish.js 

然后使用搜索命令搜索Home并替换为您的文本,下一步是在生成jsdoc时指定模板:

  $ jsdoc ./src/scripts/ ./README.md -t node_modules / jsdoc / templates / default / 


After running a basic JSDoc compile/render from Node.js:

jsdoc file1.js file2.js

I get a well-formatted document using the default template inside a directory "out". Almost all is as expected!

But when opening the document, it always says "Home" on the index.html page, has no content on that initial page, and has "Home" in the sidebar navigation.

How and where do I notate the name of the project so that it replaces "Home"? I would also like to see a project description, as well as author and copyright information.

It seems like the most basic of things to do in a JSDoc, but I can't find the information! I have tried the following, based on some random article I found on the internet:

/** 
 * This JavaScript file contains foo bar baz...
 * 
 * @projectname Project Name
 * @version 0.1
 * @author Greg Pettit
 * @copyright 2015
 * 
 */

But I get no love.

[edited to add:]

Discovered the @file / @fileOverview / @overview (all synonyms) directive, which is somewhat helpful as I can now describe and set copyright/author information for each file:

/** 
 * @file Project description which renders below the individual filename and therefore isn't a real overview blurb.
 * 
 * @version 0.1
 * @author Greg Pettit
 * @copyright 2015
 * 
 */

That leaves 2 "problems" to solve still:

  1. An overview description; I think @file takes care of most of my needs, but since it's per-file, I would still like an "introduction" type paragraph or overview paragraph that appears before the descriptions of included files.

  2. Replacing that "Home" text with custom text

解决方案

Generate Home page

Create markdown file README.md

Generating jsdoc:

$ jsdoc path/to/js path/to/readme/README.md

To read more about this visit official documentation

Change 'Home' text

I don't think this is a proper way to do it but this works.

If you have jsdoc installed in your project find template file in your working directory, mine was:

./node_modules/jsdoc/templates/default/publish.js

Then search for 'Home' with search command and replace with your text, next step is to specify template when generating jsdoc:

 $ jsdoc ./src/scripts/ ./README.md -t node_modules/jsdoc/templates/default/

这篇关于默认“主页” JSDoc的文本和内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆