Skip to content

SOLR-18494: Document one block style for commands in the Ref Guide - #5006

Open
serhiy-bzhezytskyy wants to merge 8 commits into
apache:mainfrom
serhiy-bzhezytskyy:SOLR-18494-command-block-convention
Open

serhiy-bzhezytskyy wants to merge 8 commits into
apache:mainfrom
serhiy-bzhezytskyy:SOLR-18494-command-block-convention

Conversation

@serhiy-bzhezytskyy

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/SOLR-18494

Description

Command blocks in the Ref Guide use several styles: of 624 blocks holding a curl or bin/solr command on main, 473 are bash, 123 are console and 28 use text, plain, terminal, sh, powershell or no language. The authoring guide says only "when in doubt, choose text".

Solution

Adds a "Command Blocks" section to dev-docs/ref-guide/asciidoc-syntax.adoc: bash without a prompt for commands only, console with $ when the output is shown too, text for output alone, powershell for the Windows variant. The pages themselves are not touched; they can follow once the rule is agreed.

Written with Claude Code.

Tests

The page renders and the new cross-reference resolves. The example command and output are copied from tutorial-films.adoc.

Checklist

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide
  • I have added a changelog entry for my change

The authoring guide only said to use text when in doubt, while most command
blocks use bash and others console, so new pages kept mixing styles. Spell out
which style a block of commands, commands with output, and output alone get.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 2, 2026
Comment thread dev-docs/ref-guide/asciidoc-syntax.adoc Outdated
@@ -88,6 +88,28 @@ Use one of the valid short names to get syntax highlighting for that language.

Ideally, we will have an appropriate lexer to use for all source blocks, but that's not possible.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is this not possible? Has antora/asciidoc not expanded to cover everything? Not sure this blanket statement is still true. Maybe?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That sentence was written for Rouge, but the published Guide is highlighted by highlight.js, so I corrected the section (ceb5ba9). And "not possible" is almost no longer true: 22 of the 2,478 blocks with a language use a name the highlighter lacks (powershell 8, terminal 6, bat 4, and one each r, promql, csv, subs); the rest are highlighted.

@epugh epugh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. One thing I tried a while ago was to make the "copy" command in the Ref Guide work. I think in antora you could have a copy icon so you would get just the command without the $, but I didn't have any luck with it. It would sort of work. Might be worth a quick check to see if that feature works better now.

@epugh
epugh requested a review from janhoy October 4, 2026 13:19
@epugh

epugh commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Let's leave this PR open a few more days, see if we get any other feedback on it?

The authoring guide named Rouge and its lexer list, but the published pages use the highlight.js build of the UI bundle, which has 35 languages. The section now names those, says what happens to any other name, and notes that powershell is not among them yet.
@epugh

epugh commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Is this PR done then? If it's only documentation? Or, are you also in this PR fixing the various styles? (Or did the get done elsewhere)....

…uide

The list would go stale with the first change to the UI bundle; the section now says that the bundle decides which languages are highlighted and what happens to any other name.
@serhiy-bzhezytskyy

Copy link
Copy Markdown
Contributor Author

Checked the script behind the copy button in the Guide's UI bundle: on a console block that starts with $ it copies only the commands, without $ and without the output; a bash block is copied as is. So the rule matches how it works.

A reader who copies a block should get the commands and nothing else. A block with commands only is now `bash` without a prompt, a block with commands and their output is `console` with `$`, and output alone is `text`; the Windows variants stay `powershell`.
@serhiy-bzhezytskyy

Copy link
Copy Markdown
Contributor Author

Not only documentation: cd7108c applies the rule to the pages, 192 command blocks in 26 files.

…tton

The copy button takes only the `$` lines of a console block, so a command with a multi-line argument would be copied as its first line.
@epugh

epugh commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

thanks, I think I was seeing just a single commit fo rsome reason, and was suprised there were more files changed! testing now!

The `--version` command simply returns the version of Solr currently installed and immediately exists.

[source,bash]
[source,console]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this be source,console? I guess I don't see a single pattern of when we sue bash and when we use console?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Already console at dac8b99: it shows the output (X.Y.0) under the $ line. The rule in dev-docs/ref-guide/asciidoc-syntax.adoc (lines 97-99): commands plus output use console with $, commands only use bash with no prompt.

First export the documents, making sure to ignore any fields that are populated via a `copyField` by specifying what fields you want to export:

[,console]
[,bash]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this be source,bash ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Already bash at dac8b99: commands only, no prompt, so the copy button copies the block as is.

@epugh epugh added this to the 10.x milestone Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants