Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

217
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda