Skip to content

Use reference links for type docs #948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wopian opened this issue Nov 7, 2017 · 2 comments
Closed

Use reference links for type docs #948

wopian opened this issue Nov 7, 2017 · 2 comments

Comments

@wopian
Copy link

wopian commented Nov 7, 2017

Currently, the generated documentation includes many references to the same String, Object etc. MDN pages. This can get pretty unwieldy when checking the markdown in diff logs for deeply nested parameters:

-   `model` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
-   `params` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
    -   `params.page` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
        -   `params.page.limit` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)**
        -   `params.page.offset` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)**
    -   `params.fields` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
    -   `params.filter` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
    -   `params.sort` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
    -   `params.include` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
-   `headers` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**

The same parameter list can be written with reference links, which provides a cleaner diff log and also heavily reduces the documentation's output size (48% reduction with this example)

-   `model` **[String]**
-   `params` **[Object]**
    -   `params.page` **[Object]**
        -   `params.page.limit` **[Number]**
        -   `params.page.offset` **[Number]**
    -   `params.fields` **[Object]**
    -   `params.filter` **[Object]**
    -   `params.sort` **[String]**
    -   `params.include` **[String]**
-   `headers` **[Object]**

[String]:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
[Object]:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
[Number]:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number

Which would render identically as:

@tmcw
Copy link
Member

tmcw commented Nov 7, 2017

Sounds like a good idea! I think remark-reference-links would do the trick. Would you be interested in contributing this change?

@wopian
Copy link
Author

wopian commented Nov 8, 2017

Currently don't have the time at hand due to uni deadlines coming up 😞

jaydenseric added a commit to jaydenseric/documentation that referenced this issue Feb 28, 2018
Fixes documentationjs#948.

This approach might be problematic when inserting markdown under a readme heading if the readme already has link references with conflicting ID’s.
@tmcw tmcw closed this as completed in ab494dd Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants