rohennes / vale-asciidoc

Vale package for validating Asciidoc markup
2 stars 2 forks source link

$ or # in terminal blocks false positives #2

Closed rohennes closed 1 year ago

rohennes commented 2 years ago

$ or # symbols are not valid in terminal commands on Windows. Should add an option to exclude flagging of C:\>

 [source,terminal]
----
C:\> net user <username> 
----
rohennes commented 2 years ago

Or this:


source,terminal]
----
$ oc debug node/<node_name>
----

. Change your root directory to the host:
+
[source,terminal]
----
sh-4.2# chroot /host
----
rohennes commented 2 years ago

.Expected output Should expected output be incorrect as the style guide does say use .Example output.

aireilly commented 2 years ago

.Expected output Should expected output be incorrect as the style guide does say use .Example output.

Yeah I think so

rohennes commented 2 years ago

The below code snippets display the contents of a file. Strictly speaking, it's not a terminal command or output. Perhaps the style guide should say remove the 'terminal' attribute if it's just a snippet of a random file?

The variables can also be read from file using the `--env-file` argument. The following is an example file called `postgresql.env`:

[source,terminal]
----
POSTGRESQL_USER=user
POSTGRESQL_DATABASE=db
POSTGRESQL_PASSWORD=password
----
You can store your parameters in a file, then use that file with `--param-file` when instantiating a template. If you want to read the parameters from standard input, use `--param-file=-`. The following is an example file called `helloworld.params`:

[source,terminal]
----
ADMIN_USERNAME=admin
ADMIN_PASSWORD=mypassword
----
rohennes commented 2 years ago

Adding exceptions to the rule for:

The output of text from files is still being flagged but is TBD if that is an issue or not.

aireilly commented 1 year ago

image

This is valid and should be allowed:

[source,yaml]
----
include::yaml/boundary-clock-ptp-config.yaml[]
----
rohennes commented 1 year ago

This shouldn't trigger an error

[source,terminal]
----
NAME          DRIVER               DELETIONPOLICY   AGE
lvms-vg1      topolvm.io           Delete           24h
----

edit: this is OK and as designed, it should have .Example output title.

CheckDollarSymbolInTerminalBlock rule is unclear IMO. There should be one rule for the $ / # cmd prompt, and another for example outputs.

rohennes commented 1 year ago

The following codeblock should not be flagged as in error:

[source,terminal]
----
[core@control-plane-1 ~]$ sudo kubensenter
----
rohennes commented 1 year ago

image

This is valid and should be allowed:

[source,yaml]
----
include::yaml/boundary-clock-ptp-config.yaml[]
----

Looks like an issue related to nesting rule rather than false positive for the prompt in a code block rule

rohennes commented 1 year ago

https://github.com/rohennes/vale-asciidoc/commit/a3b39172ab8e84f8d05948cf404918e8bbbd693c fixes all examples in this issue.

I think the only remaining issue is to separate .Example output and cmd prompt rules. Will create a separate issue for that. But also there is the wrinkle that some file outputs use the terminal attribute, when strictly speaking it's not terminal output. So i think there is user error there or something to be sorted in the SSG.