javascript - 记录 Javascript/React

标签 javascript reactjs documentation

我在用 JavaScript 或 React 组件记录代码时寻找最佳实践。在记录时,有什么可以被视为“不错的工具/库”? 谢谢。

最佳答案

对于使用了很长时间且目前仍在使用的 JavaScript,有 JSdoc3 .

JSDoc 3 is an API documentation generator for JavaScript, similar to Javadoc or phpDocumentor. You add documentation comments directly to your source code, right alongside the code itself. The JSDoc tool will scan your source code and generate an HTML documentation website for you.

但是看起来这个存储库的支持目前看起来已经失效,但它仍然被很多人使用。

还有其他选择:

  • yuidoc

    YUIDoc is a Node.js application that generates API documentation from comments in source, using a syntax similar to tools like Javadoc and Doxygen.

  • apidoc (但更专注于 RESTful API)

    Inline Documentation for RESTful web APIs apiDoc creates a documentation from API annotations in your source code.


现在,如果您正在寻找与 React/Components 更集成的东西,以及用户可以在其中玩耍和查看实时代码的 Playground ,还有其他选择(更面向 UI 组件):

  • React Styleguidist

    Isolated React component development environment with a living style guide

  • Storybook

    Storybook is a UI development environment and playground for UI components. The tool enables users to create components independently and showcase components interactively in an isolated development environment.

  • Docz

    Today, tools that allow us to be quick and effective in what we are doing are really necessary. We can't afford to lose time with tasks that should be trivial. This is why docz was created.

Docz 和 Styleguidist 都有一个 Playground ,用户可以在其中玩耍并查看实时代码和读取组件属性类型的自动属性。第一个文档是用 MDX 文件编写的,第二个文档是用简单的 markdown 编写的。 Docz 可能是最容易使用的一个,但它们都能满足您的需求。

对于 Storybook,我知道它是一个很棒的工具,但我从未使用过它,所以我可以告诉你更多关于它的信息。

JSDocs 也可以用于记录组件但没有交互状态。

关于javascript - 记录 Javascript/React,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53284303/

相关文章:

javascript替换第一个/最后一个字母并将中间文本包含在标签中

javascript - 当使用 jquery 在同一行中选择另一个选择框时,如何禁用另一个选择框

javascript - 如何在 filter 方法中返回与 && 内部回调函数连接的 bool 值?

javascript - React Native 中的 Arraylist 添加/删除 View

laravel - 如何在 Javascript 中将对象数组转换为 GraphQL 格式?

windows - Windows文件系统是如何工作的?

c - 在 Doxygen 中处理两个同名的不同函数

javascript - 从文件服务器读取 XML 文件?

javascript - 在渲染子元素之前加载数据 React

python - 如何在 python 中查找/阅读有关方法和模块的文档?