Does anyone know of a pod (or other tool/code that...
# questions
c
Does anyone know of a pod (or other tool/code that does the same) that extracts top-level comments and signatures from a file of code, into a hierarchical structure? Example: Given a project that has a structure like this:
src/models/routine.ts
The file has a
class Routine
with comments above it. The class has
function start(offsetSeconds: number)
with comments above it. It generates:
models.routine.md
with
## class Routine
that has
### function start
, with the comments as the content within each header. This would open for many things, one of the most exciting ones being: - Predictable "dendron-note-to-generated-note" linking - Guarding against comment rot through dendron discovering missing references after pod export run - Guarding against inverse documentation rot through dendron discovering missing references to notes from inside the generated markdown For comment rot: Given that text in
r.routines.lifecycle.md
referred to the code with
[[Routine model|models.routines#routine]]
, the missing link detection would identify if
src/models/routines.ts
or its (top level) signatures are renamed or removed. For "inverse documentation rot": Given that a comment in
src/models/routine.ts
said something like
The full routine lifecycle is visualized in [[r.routines.lifecycle#visualized]]
, the missing link detection would identify if
r.routines.lifecycle.md
or the
visualized
header, are renamed or removed.
k
don't know any but that would be awesome. you might be able to add ts-doc to do this
you could combine it with a custom pod to add it to dendron https://wiki.dendron.so/notes/6322a2de-34fd-4c93-bcbe-d71c30e5f2b6.html#summary
c
That's an interesting approach! I wonder about the application for other languages if ts-doc would be part of it. If the pod could be given a language aware extractor of some kind, it could become reusable across languages.
k
I know a lot of parsing libraries using https://tree-sitter.github.io/tree-sitter/ as a base