Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

213
Vistas
Any standard way to export structured js/json from jsdoc comments

I want to use jsdoc comments from a javascript file inside an interactive component (like property definitions appearing on hover), but I can’t find a way to do that as jsdoc is primarily intended to export html files.

Is there a straightforward way to parse jsdoc comments from a file as structured data that I can then consume in my UI?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

[…]as jsdoc is primarily intended to export html files.

Probably the most common use case but definitely not the only one.

I personally never use JSDoc itself to generate documentation. I use the -X option then jq to transform the parse tree.

Example: index.js

/**
 * The answer to everything
 * @return {number}
 */
function asnwer() {
  return 42;
}
npx jsdoc -X index.js
[
    {
        "comment": "/**\n * The answer to everything\n * @return {number}\n */",
        "meta": {
            "range": [
                56,
                90
            ],
            "filename": "index.js",
            "lineno": 5,
            "columnno": 0,
            "path": "/workspaces/dev",
            "code": {
                "id": "astnode100000002",
                "name": "asnwer",
                "type": "FunctionDeclaration",
                "paramnames": []
            }
        },
        "description": "The answer to everything",
        "returns": [
            {
                "type": {
                    "names": [
                        "number"
                    ]
                }
            }
        ],
        "name": "asnwer",
        "longname": "asnwer",
        "kind": "function",
        "scope": "global",
        "params": []
    },
    {
        "kind": "package",
        "longname": "package:undefined",
        "files": [
            "/workspaces/dev/index.js"
        ]
    }
]
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda