Coder Social home page Coder Social logo

goofballtech / extract-documentation-comments Goto Github PK

View Code? Open in Web Editor NEW

This project forked from anadian/extract-documentation-comments

0.0 0.0 0.0 10.57 MB

Simply extract documentation comments from a source file.

License: MIT License

JavaScript 100.00%

extract-documentation-comments's Introduction

extract-documentation-comments

standard-readme compliant Semantic Versioning 2.0.0 License npm Build Status Coverage Status David Conventional Commits

Simply extract documentation comments from a source file.

Table of Contents

Background

I created this project because I felt all of the other "parse source-code comments to generate documentation" solutions were unsatisfactory for what I needed.

  • Doxygen Is dated, obtuse, and its assumptions make it difficult to extend to language without very C-like syntax.
  • JavaDoc, JSDoc, or any other <LANGUAGE NAME>Doc-type solution are, obviously, limited to a single language; they can usually only produce opinionated HTML natively, relying on unmaintained third-party extensions to produce anything else; and they all have slightly unique syntaxes that are confusingly similar yet problematically different.
  • Natural Docs Well definitely my favourite solution I've seen so far, its comment syntax is breezy and readable and it can easily be extended to any language, it still suffers from the issue of only natively producing HTML and its syntax can be pretty limited.

Plus, I found all of the documentation solutions above to be kind of poorly documented (with the possible exception of Natural Docs) which is kind of ironic ... so I decided to create my own ultra-minimalist solution to the "generate document from special source code comments" problem!

extract-documentation-comments does just that: it simply extracts any documentation between /** and */ lines in a source code file, or any input really. Why? Because:

  • It's simple stupid: can easily be modified or extended to any specific use case.
  • It makes zero assumptions about the text between the /** and */ so you're free to markup the text in any way you want; Markdown, reStructuredText, XML, whatever and convert it to what you need after the fact. I recommend PanDoc for this.
  • It can easily be finagled to be backwards compatible with any existing source-code documenting solution.

Install

npm install extract-documentation-comments to install it to a local package or npm install --global extract-documentation-comments to install it globally.

Usage

To use the command-line interface npx extract-documentation-comments or just extract-documentation-comments if installed globally.

CLI

extract-documentation-comments

  Simply extract documentation comments from a source file. 

Options

  -h, --help                 Writes this help text to stdout.                                              
  -n, --noop                 [Reserved] Show what would be done without actually doing it.                 
  -v, --verbose              Verbose output to stderr.                                                     
  -V, --version              Writes version information to stdout.                                         
  -x, --no-quick-exit        Don't immediately exit after printing help, version, and/or config            
                             information.                                                                  
  -i, --stdin                Read input from stdin.                                                        
  -I, --input string         The path to the file to read input from.                                      
  -t, --test                 Run unit tests and exit.                                                      
  -o, --stdout               Write output to stdout.                                                       
  -O, --output string        The name of the file to write output to.                                      
  -p, --pasteboard           [Reserved] Copy output to pasteboard (clipboard).                             
  -c, --config               [Reserved] Print configuration values and information to stdout.              
  -C, --config-file string   [Reserved] Use the given config file instead of the default.                  

API

const ExtractDocumentationComments = require('extract-documentation-comments');

See API.md for full API.

Contributing

Changes are tracked in CHANGELOG.md.

License

MIT ©2020 Anadian

SEE LICENSE IN LICENSE

Creative Commons License
This project's documentation is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

extract-documentation-comments's People

Contributors

anadian avatar goofballtech avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.