tmcw / dx-spec

Issue (and spec) repository for the development of a spec that would succeed JSDoc.
27 stars 0 forks source link

mdconf-style tags #14

Open tmcw opened 6 years ago

tmcw commented 6 years ago

In drafting up the spec and testing out some code examples in CommonMark, I'm really liking the approach of mdconf's tags: instead of

// @param a {string}
// @param b {string}
function b(a, b) {}

It'd be

// - param: a {string}
// - param: b {string}
function b(a, b) {}

Advantages being:

tmcw commented 6 years ago

Thoughts: how do we differentiate between these lists of structured data and unstructured lists that are part of the description? For instance:

// wow what a great method we have here
// it does a bunch of things like
// - slices
// - dices
//
// - param: a {string}
// - param: b {string}
function b(a, b) {}
tmcw commented 6 years ago

Considerations:

mdconf isn't going to be the savior here: the implementation is pretty tolerant/unpredictable


console.log(JSON.stringify(parse(`# Test

- a: 1
- b: 2`), null, 2));

-> {
  "test": {
    "a": "1",
    "b": "2"
  }
}

console.log(JSON.stringify(parse(`# Test

- a: 1
- b: 2
- c`), null, 2));

-> {
  "test": [
    "c"
  ]
}

Going to write a stricter implementation. Optional params should be settable as just true, due to how tags like deprecated should work.

jamiebuilds commented 6 years ago

I would take inspiration from TOML