You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do I want selectors or matchers that work off of the general structure of the doc, without reference to specific items? For example, # [0] for "the first section", or @parent for the parent element?
My starting position has been no; that jq already does this very well, so I should just let people use --json and then have jq take it from there.
But link references complicate this a bit. Let's say I have the following doc:
# Section one
My [first link][1].
# Section two
My [second link][2].
[1]: https://example.com/1[2]: https://example.com/2
In this case, picking just the first section means that the output would not contain the [2]: https://example.com/2 link. If I just piped it to jq '{section: .items[0], links: .links}', then I'd get just the first section, but both links. At the jq level, it's not very easy to filter away the links that aren't needed anymore.
This is a low-priority enhancement for now, and I'd probably want to get a couple use cases before I go down this route, to make sure I get the right abstraction.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Do I want selectors or matchers that work off of the general structure of the doc, without reference to specific items? For example,
# [0]
for "the first section", or@parent
for the parent element?My starting position has been no; that
jq
already does this very well, so I should just let people use--json
and then havejq
take it from there.But link references complicate this a bit. Let's say I have the following doc:
In this case, picking just the first section means that the output would not contain the
[2]: https://example.com/2
link. If I just piped it tojq '{section: .items[0], links: .links}'
, then I'd get just the first section, but both links. At the jq level, it's not very easy to filter away the links that aren't needed anymore.This is a low-priority enhancement for now, and I'd probably want to get a couple use cases before I go down this route, to make sure I get the right abstraction.
Beta Was this translation helpful? Give feedback.
All reactions