-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Overhaul of the Manual #3189
base: master
Are you sure you want to change the base?
Overhaul of the Manual #3189
Conversation
@itchyny, thanks a lot for your improvement suggestions!
I adapted the run buttons and the examples links (although adapting the latter to precisely match the current manual would probably take quite a bit more time, just let me know if the current solution is an issue). Concerning the output alignment, I'm not sure whether I understand the issue, because outputs seem aligned to me:
I added the anchor link icons. I also tried to preserve more of the existing anchor links; however, this is sometimes not possible where the structure between the old and the new version has changed too much. Still, much more links should match their old IDs now. (Including your example, |
Good suggestion. Let us do this once this PR is merged. I'm reluctant to make content changes at this point. |
docs/content/manual/manual.md
Outdated
path = atomic, part | ||
| ".", ident | ||
| path, part | ||
| path, part, "?" |
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.
How can you parse .foo??
in this definition?
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.
.foo?
is a path, and .foo??
is equivalent to (.foo?)?
; that is, catching all errors from the path .foo?
. We can see this by the following:
$ jq -n '.[error]?'
jq: error (at <unknown>) (not a string): null
$ jq -n '.[error]??'
$ jq -n '(.[error]?)?
(Here, the last two commands do not output anything, because the second ?
silences all errors of the path, including the error from error
.)
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.
A path should be followed by part
before ?
in your definition, but .foo??
cannot be parsed because part
is missing. If any path can be followed by ?
, it should be path = path "?"
?
docs/content/manual/manual.md
Outdated
|
||
::: | ||
|
||
## String formatting functions |
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.
I think these are called string formats. They can be used like filters, but when placed before strings they can format interpolations, so different concept from functions.
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.
The jq 1.7 manual says: "The @foo syntax is used to format and escape strings [...]", but it never really gives an explicit name for @...
. You are right that they are not completely like functions, because they can be used before strings (unlike regular functions), but they can be also used like functions. I added a note about this to the manual now, but left the name of the section unchanged. Please let me know if you are happy with that, otherwise I can still change it.
Custom arrows seem to cause problems with Safari, and they look terrible when using dark mode.
Thanks a lot for all your comments, @itchyny! |
From @wader:
I think this is a very good idea, and a much more elegant solution than the current manual conversion of md -> yml -> html with the Python code. You could either (1) use a static site generator, like Jekyll (GitHub pages native) or Hugo (faster, more modern, bit easier to use), or (2) since pandoc is already used, just use that to convert everything from md to html and add that to the template. I think (1) is probably the easier approach. It has builtin support for TOC creation, templates, includes and more. I could create a POC for this if you want. Another benefit would be that you can have a website repo with just the website code, that pulls it's content (the markdown files) from this repo on changes. This separates all markup and website code from this repo, while still keeping the actual documentation close to the code. |
@yochem yeap would be great to look into such things after we get this PR merged, it's already quite large and dragged on for a long time 😅 |
Yes definitely haha! I was not suggesting to include that in this PR, just a suggestion for after that. Maybe would've been better to create a separate issue for it. Sorry for the noice! |
I also agree with you, but the problem is that the manual for the older jq versions also need to be generated somehow. And they are in YAML. So while the current solution in this PR is a bit clumsy, it ensures backwards compatibility. If the older manuals were not around, then generating HTML from Markdown directly would become feasible. |
pandoc.RawInline("html", "</summary>") | ||
} | ||
return { | ||
pandoc.RawBlock("html", '<details class="pb-3">'), summary, el, |
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.
Can you apply the small
class to this details tag instead of the summary tag?
In the last days, I've completely overhauled the jq manual. Some of the most important changes:
|
, it is useful to know how to construct values first, and to understand paths such as.posts[0]
, it is useful to understand|
first.All in all, this PR adds a lot of new information to the jq manual and tries to improve its structure.
To see it in all its glory, you need Pandoc >3.0. Go to
jq/docs
, runpipenv sync
, thenand open http://0.0.0.0:8000/output/manual in your browser.
Please let me know if I can do something to get this merged.
This builds on and supersedes my previous PR (#3186).