Giter Site home page Giter Site logo

yuidoc-to-jsonapi's People

Watchers

 avatar  avatar

yuidoc-to-jsonapi's Issues

Documenting top level ES module items

Suppose I'm writing an ES2015 module with some top level exports. I could (incompletely) document it roughly along these lines:

/**
  @property MAGIC_VALUE
*/
export const MAGIC_VALUE = 'hello';

/**
  @method compareLength
*/
export function compareLength(input) {
  return MAGIC_VALUE.length - input.length;
}

YUIDoc doesn't really have a notion of functions/values that aren't associated to a class, and its own notion of modules and namespaces don't align with ES2015 modules. If I were to pass this through the doc parser, I'd wind up with output like this:

{
  classes: {},
  classitems: [
    { class: '', itemtype: 'property', name: 'MAGIC_VALUE', ... },
    { class: '', itemtype: 'method', name: 'compareLength', ... }
  ],
  ...
}

Today, yuidoc-to-jsonapi would drop those items on the ground in the conversion, since they don't correspond to a class. Note that, since there is a file associated with each classitem, we can still tell which module they originated from.

In the Ember codebase today, functions like Ember.String.underscore are modeled as being part of a @static String class, and the doc viewer specially presents static classes as "namespaces" (distinct from the YUIDoc notion of the word). With RFC 176 moving from presenting things like Ember.String.htmlSafe to import { htmlSafe } from '@ember/string', though, this starts to feel less natural.

Meanwhile, in ember-cli-addon-docs we're working on making it as easy as possible for addon authors to set up rich documentation for their projects, and part of that is having an API reference. It doesn't feel ideal to have to propose "invent a name for an invisible static class" as the best practice for documenting ES2015 modules.

Fundamentally it feels like YUIDoc may be missing a primitive here, but the project seems relatively stagnant at this point, so adding new concepts there may or may not be in the cards.

Given all that, I'd love to start a conversation about what the ideal way is to model top-level module items, both from the author's perspective and in terms of how it's represented in the JSON API data.

/cc @sivakumar-kailasam

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.