Skip to content
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

docs: Move language references to a Reference section #5375

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jennings
Copy link
Contributor

I think the reference pages for the revset, fileset, and templating languages are different concerns from the configuration reference pages.

As suggested by @arxanas, I've moved the language descriptions into a new Reference section.

Then I created new pages revset-aliases.md and template-aliases.md in the Configuration section for the well-known aliases like immutable_heads(), format_timestamp(), etc.

@jennings jennings force-pushed the jennings/push-vppqntkptzzw branch 2 times, most recently from 69193a1 to 3faa39f Compare January 15, 2025 23:29
@jennings
Copy link
Contributor Author

The "Check that MkDocs..." build failure seems caused by this issue: astral-sh/uv#10654

@jennings jennings force-pushed the jennings/push-vppqntkptzzw branch from 3faa39f to 46ac4a5 Compare January 16, 2025 00:35
@martinvonz
Copy link
Member

Seems like @ilyagr should review this (others can of course also review). Will you have time to look at this?

@ilyagr
Copy link
Contributor

ilyagr commented Jan 16, 2025

Could you rebase? I'd like to know whether CI will pass now that uv 0.5.20 was released (I'm guessing CI will run after a rebase, hopefully? Though maybe github actions are simply down; I think I saw similar symptoms caused by that once).

Since 0.5.19 was the newest version for less than a day, perhaps we can ignore its existence...

Update: By the way, the check that uses the latest version of uv is not supposed to be required anyway.

Copy link
Contributor

@ilyagr ilyagr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, splitting config.md sounds great to me! A reference section also sounds great.

I had a bunch of minor comments. There's also a comment I marked as "Open-ended confusion" about [revsets] and [templates] that I'm not sure what to do about.

docs/config.md Show resolved Hide resolved
docs/template-aliases.md Outdated Show resolved Hide resolved
docs/revset-aliases.md Outdated Show resolved Hide resolved
docs/config.md Show resolved Hide resolved
docs/config.md Show resolved Hide resolved
docs/template-aliases.md Outdated Show resolved Hide resolved
docs/template-aliases.md Outdated Show resolved Hide resolved
"trunk()" = "dev@origin"
```

## `immutable_heads()`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it would be cryptic to a new reader.

Perhaps something like "immutable_heads(): changing the set of immutable commits"? Or maybe have a redundant subheading:

## Changing the set of immutable commits

### `immutable_heads()`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was concerned about breaking links if we rephrase it. This anchor is #immutable_heads, but adding more text would lead to #immutable_heads-changing-the-set-of-immutable-commits, which would break if we rephrase it to, say, "immutable_heads(): Set of immutable commits".

I didn't see a way to control what anchor MkDocs uses. Ideally, the anchor would be #immutable_heads but the visible text would be more descriptive.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was also worried a bit, perhaps the "redundant subheading" option might help. If we can't figure out an ideal solution, I think readability is more important than potential changes to heading anchors.

I also don't know a good way to affect MkDocs anchors or add new ones. We could use HTML, problably, but that'd be terrible for reading the docs in the terminal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! I found how to set anchors with just markdown:

### `immutable_heads()`: Set of immutable commits {#immutable_heads}

I've added more descriptive text to both trunk() and immutable_heads().

docs/revset-aliases.md Outdated Show resolved Hide resolved
docs/revset-aliases.md Outdated Show resolved Hide resolved
@jennings jennings force-pushed the jennings/push-vppqntkptzzw branch 4 times, most recently from d56baae to b5b9c4f Compare January 22, 2025 05:52
@jennings jennings requested review from yuja and ilyagr January 22, 2025 05:55
docs/config.md Outdated Show resolved Hide resolved
mkdocs.yml Outdated
Comment on lines 122 to 126
- 'Revset language': 'revsets.md'
- 'Fileset language': 'filesets.md'
- 'Templating language': 'templates.md'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: just sort them in lexicographical order?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I was thinking to sort them by "importance" but there's only three so it really doesn't matter.

'format_time_range(time_range)' = 'time_range.start() ++ " - " ++ time_range.end()'
```
You can use relative timestamps by adjusting the [`format_timestamp()` template
alias](template-config.md#format_timestamp).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need links per sub section? I think something like this is good enough:

## Log

...

### Template and style

See [Log template configuration](..) for details .. blah blah

I think related config variables can also be moved there. For example, ui.log-word-wrap is NOT a template parameter, but it applies to log template output.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a request to remove headings like "Relative timestamps", "Author format", etc., and just have one blanket section "Template and style" that links over to the template-config.md page. Do I understand correctly?

@ilyagr suggested keeping these headings so incoming links don't break, like the link to #node-style that jj log --help outputs.

But, now that I've found how to add custom anchors to the page, I could make all those anchors go to the relevant blanket section.

### Template and style

[](){#relative-timestamps}[](){#author-format}...

See [Log template configuration](template-config.md) for more information.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a request to remove headings like "Relative timestamps", "Author format", etc., and just have one blanket section "Template and style" that links over to the template-config.md page.

Yes. I don't think we would want to update both config.md and template/revset-config.md when adding new sections.

'commit_timestamp(commit)' = 'commit.author().timestamp()'
```
The [`commit_timestamp()` template alias](template-config.md#commit_timestamp)
controls whether the author or committer timestamp is displayed in the log.

### Signature format
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move "Signature format" to template-config.md?


This configuration section configures the default. These values can use [template
aliases](#template-aliases).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to briefly describe the overview of the [templates] section. For example, we had this in the original doc:

You can configure the template used when no `-T` is specified.

- `templates.log` for `jj log`
- `templates.op_log` for `jj op log`
- `templates.show` for `jj show`

[templates]
# Use builtin log template
log = "builtin_log_compact"
# Use builtin op log template
op_log = "builtin_op_log_compact"
# Use builtin show template
show = "builtin_log_detailed"

I also think we should omit detailed section unless there are things to be documented. For example, the ### Show section is pretty much empty.

@jennings jennings force-pushed the jennings/push-vppqntkptzzw branch from b5b9c4f to d38baae Compare January 23, 2025 06:45
@ilyagr
Copy link
Contributor

ilyagr commented Jan 28, 2025 via email

@steveklabnik
Copy link
Contributor

steveklabnik commented Jan 28, 2025

Just a few brief comments, @ilyagr :

This syntax is not part of CommonMark, and is not supported by GitHub.

If I type <http://example.com> here: http://example.com it does link on GitHub.

While I don't see it in the CommonMark specification, their "dingus" does in fact render properly too, you can try it here https://spec.commonmark.org/dingus/

In my Windows Terminal, running bash in Ubuntu, links like this are clickable, when I hover over this, it gets underlined, and when I click it, it does open the link in my browser:

image

even though I don't like its heavy reliance on React&JS magic

A nice thing about Docasaurus is that it's primarily server-side rendered, so I'm not sure which parts you object to, but it's all at build time, not in the browser.

Rust's own comment style guidlines for APIs suggest using [][] links over []() ones, but I (who authored this) forgot about <> links, so they were never considered https://rust-lang.github.io/rfcs/0505-api-comment-conventions.html

@ilyagr
Copy link
Contributor

ilyagr commented Jan 28, 2025

@steveklabnik I meant the "specifying the anchor" syntax, {#anchor}.

Aside: As a test, here is a link to two ids below: first id, second id. The first one does not work, the second one does

You can see the GitHub markdown rendering here failing here for {#trunk} (it should not be shown):

image

You can also see it below.

Here are the targets of the above links

The source is:

### This anchor does not work {#my-custom-heading-id}

<a id="my-very-custom-heading-id"></a> `<<<` There is an invisible anchor here

This anchor does not work {#my-custom-heading-id}

<<< There is an invisible anchor here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants