feat: allow more customisation to how encodings are included in source issues
It'd be cool if we could customise how encodings are presented in source issues.
E.g. for testground, I think the issue (https://github.com/testground/testground/issues/1491) would look better if we could put children: and description: encodings in headers as Description and Children respectively. As in:
# Description
<!-- DESCRIPTION GOES HERE -->
# Children
<!-- CHILDREN GO HERE -->
---
<!-- THE REST OF THE CONTENT -->
Even better if we had full control over the encodings' text. Maybe we could achieve that by allowing the encodings to be hidden inside comments? As in:
# Description
<!-- description: -->
<!-- DESCRIPTION GOES HERE -->
# Related Issues
<!-- children: -->
<!-- CHILDREN GO HERE -->
# Other Things
<!-- ... -->
I love the idea of the encodings being more readable, and giving users a chance to customize those. Leaving this decision for @wilkyr31d
@galargh with your approach, do you think it would work fine like this:
- Check for label ("description:", "children:", etc..)
- search on next lines for github links (short-id, long-id, full URL, etc), stopping when there is no match
- repeat for all markdown sections
@whizzzkid @juliaxbow what do you two think of this feature request?
I'm not sure I quite understand this algorithm. Could you add an example maybe?
@galargh I have since added support for github tasklists, so that provides another solution for defining children, but the description parsing still needs some love.
The code for parsing children is at
- https://github.com/pln-planning-tools/Starmap/blob/e26da1fccb63edbee843936bfddb0b2709bbf6f9/lib/parser.ts#L63-L75
- https://github.com/pln-planning-tools/Starmap/blob/e26da1fccb63edbee843936bfddb0b2709bbf6f9/lib/parser.ts#L32-L40
Apparently, description parsing wasn't done already, so i'm adding it as a part of https://github.com/pln-planning-tools/Starmap/issues/120, and my algorithm is going to be something like this for description:
- Search for "description:" in the text. if not found, skip, there is no description
- If found, split on the line where "description:" was found on a space (
" ") and select the second half (index=1) as the very first line (it may be empty) - Remove any "-->" text from the first line (handle the edge-case mentioned below)
- While no blank line is found, add found lines to a line array.
- When a blank line is found, it's the end of the description
steps 1-2 are basically covered at https://github.com/pln-planning-tools/Starmap/blob/e26da1fccb63edbee843936bfddb0b2709bbf6f9/lib/parser.ts#L32-L40.
Using the basic algorithm above, you could format a description like so and it should work (I'll add a test for this):
<!-- description:
My milestone description
thing1
thing2
-->
Ideally, descriptions should be renderable. We don't want users to have to maintain two lists of descriptions, so the following should also work.
edge-case
<!-- description: -->
My milestone description
thing1
thing2
Some other thing that's not considered part of the description
Some questions based on the above:
- Do you want to leave in support for "children:" similar to the above description approach (beyond tasklists)
- Is the above approach satisfactory for descriptions?
- I don't imagine we will support newlines in starmap, so starmap description snippets end as soon as a newline is encountered. Do you see any issues with this?