#28841 closed task (blessed) (fixed)
Use markdown syntax and/or hash notations for doc block lists
Reported by: | coffee2code | Owned by: | |
---|---|---|---|
Milestone: | 4.1 | Priority: | normal |
Severity: | minor | Version: | 3.9 |
Component: | General | Keywords: | has-patch |
Focuses: | docs | Cc: |
Description
The doc blocks for various functions enumerate items via lists (namely to document supported array arguments). However, not all of the function doc blocks use the markdown list syntax in doing so. Not only is this internally inconsistent, it violates the formatting guidelines, which also prevents the lists from being rendered as lists in the Code Reference.
An example of a function with a properly formatted list in its doc block is register_taxonomy()
(src, which can be seen with its list displayed as a list on the Code Reference).
An example of an unformatted list is wp_insert_user()
(src, as seen on Code Reference) (which also in this case and others, not using the markdown list syntax causes indented line continuations to be treated as code blocks).
Eventually the hard breaks the Code Reference currently inserts for newlines between consecutive lines of text during import/display will be removed, leaving these non-lists to merge into a single paragraph/run-on sentence.
The attached patch corrects the doc block list formatting found in wp-includes/*.
In most cases, the list syntax is being added to what is simply a newline-separated list of items. In a few cases, explicit list HTML (also a formatting guideline violation) is being replaced with the markdown syntax. In one case (get_terms()
in taxonomy.php) a multi-paragraph formatted list is reformatted into an actual list.
Files affected:
- bookmark-template.php (2 functions)
- bookmark.php (1 function)
- class-http.php (2 functions; HTML removal)
- functions.php (1 function)
- general-template.php (1 function; HTML removal)
- post.php (1 function)
- post-template.php (1 function; HTML removal)
- shortcodes.php (1 function)
- taxonomy.php (1 function)
- user.php (2 functions)
- wp-db.php (1 function)
* Undoubtedly, most, if not all, of these problem lists would be moved into the appropriate @param documentation rather than remaining in the function's long description, as has already recently been done for register_post_status()
and register_post_type()
. Which may be the true fix, but until then...
* There is also an inconsistency with the presence of single quotes around a list key item (the array keys being documented), which is not addressed in this patch. For example: get_post_type_labels()
does not quote its keys, get_posts()
does.
Attachments (3)
Change History (20)
#1
@
10 years ago
- Milestone changed from Awaiting Review to Future Release
- Type changed from defect (bug) to task (blessed)
#2
@
10 years ago
Thanks for the patch and the ticket. Some of these actually need to be converted into hash notations, so I'll probably split it into several patches just to reduce confusion.
#3
@
10 years ago
- 28841.2.diff contains the proposed markdown list fixes
- 28841.3.diff contains the yet-to-be-converted hash notation fixes
#14
@
10 years ago
- Summary changed from Use markdown syntax for doc block lists to Use markdown syntax and/or hash notations for doc block lists
Patch referenced in ticket.