Skip to content
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

Docs: use markdown headings instead of links for API declarations #33381

Merged

Conversation

juanmaguitar
Copy link
Contributor

@juanmaguitar juanmaguitar commented Jul 13, 2021

Fixes #33361

Description

As per #33361 this PR generates proper headings with Symbol names (method names, selectors names, actions names, ...)

How has this been tested?

Locally, by testing the output of commands such as

npx docgen packages/core-data/src/selectors.js --output data-core-dummy.md && cat data-core-dummy.md

Types of changes

Change in the Tool used to generated Documentation (API documentation markdown from JSDOC code comments)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@juanmaguitar juanmaguitar changed the title Symbol name as proper heading level 2 Docs Tools: Symbol name as proper heading level 2 Jul 13, 2021
@juanmaguitar
Copy link
Contributor Author

juanmaguitar commented Jul 13, 2021

BTW I couldn't find a way to test LOCALLY the final HTML of the docs (like in https://developer.wordpress.org/block-editor/ ) from the markdown files.

Is there any way to generate the final HTML (the one that will be served from https://developer.wordpress.org for example) in the development environment from the markdown files to test changes like the ones in this PR?

@oandregal
Copy link
Member

👋 @juanmaguitar you may want to do two things for this to be ready:

Is there any way to generate the final HTML (the one that will be served from https://developer.wordpress.org for example) in the development environment from the markdown files to test changes like the ones in this PR?

You'd need to replicate a meta environment. I don't know how to do that, but the above command is enough to update the affected markdown files in this repo.

@juanmaguitar
Copy link
Contributor Author

juanmaguitar commented Jul 13, 2021

Thanks for the response @nosolosw

you may want to do two things for this to be ready:

  • rebase from trunk (I've just landed a related PR Fix API docs for data reference guides Fix API docs for data reference guides #33384 )
  • execute npm run docs:build to update all the auto-generated documentation for packages and reference guides

both things done 👍

@juanmaguitar
Copy link
Contributor Author

BTW I'm not sure I added so many people as reviewers. If I did, it wasn't on purpose.

Captura de pantalla 2021-07-13 a las 15 40 33

@nosolosw is this some automatic action? shall I remove these reviewers added?

@oandregal
Copy link
Member

is this some automatic action? shall I remove these reviewers added?

Yeah, it's automatic. It's fine. Those are people that opted-in to become a reviewer for particular code paths using the codeowners feature (see this file in our repo).

@oandregal
Copy link
Member

oandregal commented Jul 13, 2021

@juanmaguitar I see that the CI actions report some failing tests: packages/docgen/test/formatter-markdown.js. They need to be updated to account for the changes here as well. You can run the docgen tests locally by using the command npm run test-unit -- packages/docgen/.

@juanmaguitar
Copy link
Contributor Author

I see that the CI actions report some failing tests: packages/docgen/test/formatter-markdown.js. They need to be updated to account for the changes here as well. You can run the docgen tests locally by using the command npm run test-unit -- packages/docgen/.

Thanks for the explanation @nosolosw
Tests updated to reflect changes in the code 👍

Copy link
Member

@oandregal oandregal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, @juanmaguitar ! I'm going to let the tests end and tomorrow will merge.

For context: once it's merged in trunk, the block editor handbook typically takes 15 to 30 minutes to be updated with the new contents.

@oandregal oandregal changed the title Docs Tools: Symbol name as proper heading level 2 Docs: use markdown headings instead of links for API declarations Jul 13, 2021
@oandregal oandregal added the [Type] Developer Documentation Documentation for developers label Jul 13, 2021
@oandregal
Copy link
Member

Juanma, I've also updated the title of the PR and assigned it some labels, as that's used in the changelog of the releases: the more informative the PR titles are the more informative the changelog for consumers.

@juanmaguitar
Copy link
Contributor Author

I'm going to let the tests end and tomorrow will merge.

I've also updated the title of the PR and assigned it some labels, as that's used in the changelog of the releases: the more informative the PR titles are the more informative the changelog for consumers.

Awesome. Thanks! 🙌

@oandregal oandregal merged commit 5b32e25 into WordPress:trunk Jul 14, 2021
@github-actions github-actions bot added this to the Gutenberg 11.1 milestone Jul 14, 2021
@juanmaguitar juanmaguitar deleted the docgen-fix-heading-symbol branch July 14, 2021 08:38
@oandregal
Copy link
Member

For reference, this is the before/after in a couple of pages in the block editor:

WordPress Core Data

Before After
Screenshot 2021-07-14 at 10-29-29 WordPress Core Data Block Editor Handbook WordPress Developer Resources Screenshot 2021-07-14 at 10-54-02 WordPress Core Data Block Editor Handbook WordPress Developer Resources

a11y package

Before After
Screenshot 2021-07-14 at 10-30-03  wordpress a11y Block Editor Handbook WordPress Developer Resources Screenshot 2021-07-14 at 10-54-16  wordpress a11y Block Editor Handbook WordPress Developer Resources

@desrosj desrosj mentioned this pull request Aug 30, 2021
7 tasks
desrosj added a commit that referenced this pull request Sep 1, 2021
* Fix API docs generation (#33384)

* Docs: use markdown headings instead of links for API declarations (#33381)

* Docs: Run Prettier after updating API in documentation (#33498)

(cherry picked from commit 626f233)

* Use tabs instead of spaces in block transform doc example (#33549)

(cherry picked from commit 8afca1e)

* Fix metabox reordering (#30617).

* Block editor: don't render layout and duotone styles in between blocks (#32083)

* Widgets: Allow HTML tags in description (#33814)

* Widgets: Allow HTML tags in description

* Use `dangerouslySetInnerHTML`

Avoid `<div />` inside the `<p />` tag

* Describe by dangerouslySetInnerHTML is used

* Use safeHTML

* Update comment

* Editor: Set 'hide_empty' for the most used terms query (#33457)

Don't include terms that aren't assigned to any posts as "most used" terms.

* Update widget editor help links to point to the new support article (#33482)

* If select-all fires in .editor-post-title__input, end the process.. (#33621)

* Writing flow: select all: remove early return for post title (#33699)

* Call onChangeSectionExpanded conditionally (#33618)

* FontSizePicker: Use number values when the initial value is a number (#33679)

* FontSizePicker: Don't use units if the value is a number
* Add unit tests
* Disable units when we have number values

* Fix justification for button block when selected (#33739)

* Remove margin setting, auto right conflict with justify buttons

* Per review, add little margin back

* Add error boundaries to widget screens (#33771)

* Add error boundary to edit widgets screen

* Add error boundary to customize widgets

* Refactor sidebar controls provider to application level so that its state is not lost when re-initializing

* Revert "Refactor sidebar controls provider to application level so that its state is not lost when re-initializing"

This reverts commit 7d607ff.

* Remove rebootability from customize widgets

* Remove debug code

* Fix insertion point in Widgets editors (#33802)

* Default batch processor: Respect the batch endpoint's maxItems (#34280)

This updates the default batch processor to make multiple batch requests
if the number of requests to process exceeds the number of requests that
the batch endpoint can handle.

We determine the number of requests that the batch endpoint can handle
by making a preflight OPTIONS request to /batch/v1. By default it is 25
requests.

See https://make.wordpress.org/core/2020/11/20/rest-api-batch-framework-in-wordpress-5-6/.

* Fix button block focus trap after a URL has been added (#34314)

* Rework button block link UI to match RichText format implementation

* Refine some more, determine visibility by selection and url state

* Add e2e test

* Also focus rich text when unlinking using a keyboard shortcut

* Text for dropdown fields within legacy widgets in the Customizer is off centered (#34076)

* Fix ESLint errors reported

* Regenerate autogenerated docs

* Update the `INSERTER_SEARCH_SELECTOR` path.

This is a partial cherry pick of 2356b2d in order to fix the performance tests.

Co-authored-by: André <nosolosw@users.noreply.github.com>
Co-authored-by: JuanMa <juanma.garrido@gmail.com>
Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
Co-authored-by: Jeff Bowen <jblz@users.noreply.github.com>
Co-authored-by: Bruno Ribarić <43731400+ribaricplusplus@users.noreply.github.com>
Co-authored-by: Ella van Durpe <4710635+ellatrix@users.noreply.github.com>
Co-authored-by: Petter Walbø Johnsgård <petter@dekode.no>
Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com>
Co-authored-by: Daniel Richards <daniel.richards@automattic.com>
Co-authored-by: Hiroshi Urabe <mail@torounit.com>
Co-authored-by: Kai Hao <kevin830726@gmail.com>
Co-authored-by: Marcus Kazmierczak <marcus@mkaz.com>
Co-authored-by: Robert Anderson <robert@noisysocks.com>
Co-authored-by: Anton Vlasenko <43744263+anton-vlasenko@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: Generate proper markdown heading for API docs (enabling automatic "Table of Contents" for API pages)
2 participants