Skip to content

ValidCodeBlocks missing support for literal block .... #949

@fincd-aws

Description

@fincd-aws

Describe the bug
False positive for Unterminated listing block from ValidCodeBlocks because a literal block in same file has one ---- inside it.

The total count of ---- in the file is odd, so the ValidCodeBlocks rule is triggered. But contents inside listing blocks and literal blocks aren't rendered as AsciiDoc, so asciidoctor renders just fine.

Examples:

Kubernetes kubectl "pretty" output is styled similarly to AsciiDoc, in the kubectl describe output. To nest it, we've used a literal block ....:

[source,subs="verbatim,attributes"]
....
Name:         aws-auth
Namespace:    kube-system
Labels:       <none>
Annotations:  <none>

Data
====
mapRoles:
----
- groups:
  - system:bootstrappers
  - system:nodes
  rolearn: {arn-aws}iam::111122223333:role/my-node-role
  username: system:node:{{EC2PrivateDNSName}}


BinaryData
====

Events:  <none>
....

https://github.com/awsdocs/amazon-eks-user-guide/blob/2a98a7895efedcee8bf7aad47df1ac4db94005fa/latest/ug/manage-access/k8s-access/auth-configmap.adoc?plain=1#L73

 latest/ug/manage-access/k8s-access/auth-configmap.adoc
 37:1  error  Unterminated listing block      AsciiDoc.ValidCodeBlocks
              found in file.

To Reproduce
Steps to reproduce the behavior:

  1. Add this word or expression:
----
Create the listing block
----

....
Create a literal block that happens to have a listing block fence in another syntax.
----
....
  1. Vale reports an illegitimate alert: error.

Expected behavior

Literals such as inside a listing block or literal block, should be able to contain asciidoc syntax and not trigger the rule.

Additional context

With vale regex, this is probably pretty difficult? Is there a way to exclude the contents of listing and literal blocks from being counted in other rules?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions