-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Update qhelp style guide for markdown format #19730
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
base: main
Are you sure you want to change the base?
Update qhelp style guide for markdown format #19730
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the Query Help Style Guide to document support for Markdown-formatted query help files alongside the existing XML format.
- Introduces a new section detailing the structure and requirements for Markdown
.md
query help files. - Harmonizes references to section-level elements across both Markdown and XML formats.
- Adds a combined Markdown and XML query help example for Java.
Comments suppressed due to low confidence (2)
docs/query-help-style-guide.md:77
- The term “description section” is ambiguous in the Markdown context (we only define Overview, Recommendation, Example, etc.). Consider replacing “description section” with “overview section” or clarifying when each section should contain examples.
* Put the code example after the recommendation section where possible. Only include an example in the description section if absolutely necessary.
docs/query-help-style-guide.md:144
- Suggest clarifying that authors should not commit generated HTML (not Markdown) when writing native Markdown query help; the current wording may confuse manual vs. generated files.
Please include the query help files (and any associated code snippets) in your pull request, but do not commit the generated Markdown.
I based the updated guidance on a few java qhelp files, like this. I see there are also qhelp files for actions, like this, which have some small differences. We should decide which we way we want to go and standardize. In both cases the java ones are closer to the custom XML format.
|
1c54642
to
25adcc8
Compare
Having looked into the differences between the two, I have decided to stick with the format from the java .md files, because it is closer to the custom XML format. If you look at a code-scanning alert for an actions query, like this one, you will see two things:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you for updating this. Minor suggestions only.
|
||
Please include the `.qhelp` files (and any associated code snippets) in your pull request, but do not commit the generated Markdown. | ||
## Differences between XML and markdown formats |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more difference: only Markdown is supported for custom queries / query packs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Do you know why that is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deliberate choice to reduce the risk from processing untrusted XML. Our XML processing has protections against entity expansion, but the includes mechanism isn't completely robust to untrusted XML help. Markdown help does not have this problem. For this reason we only support XML help we've written ourselves, and require Markdown help for custom query packs.
docs/query-help-style-guide.md
Outdated
|
||
A Markdown query help file should use the following structure and section order: | ||
|
||
1. **Overview** (level 2 heading, `## Overview`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor suggestion: consider just making this a fenced code block with the five headings filled in, and gaps in between. Then it can be copied and used directly.
We now support query help files formatted as markdown, but this was not documented. I have tried to update the documentation (with a lot of help from copilot). I am not particularly familiar with markdown query help files, so I may have got some things wrong.