Repository: aws/aws-cli

Issue:
Unknown interpreted text role "abc" while calling aws help config-vars
### Describe the bug

Error is shown instead of information how to configure variables.

### Expected Behavior

Display help how to configure variables.

### Current Behavior

```
<string>:450: (ERROR/3) Unknown interpreted text role "doc".
<string>:567: (SEVERE/4) Title level inconsistent:

==============
Global Options
==============

<string>:567: (SEVERE/4) Title level inconsistent:

==============
Global Options
==============
```

### Reproduction Steps

aws help config-vars

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CLI version used

aws-cli/2.8.2 Python/3.9.11 Windows/10 exe/AMD64 prompt/off

### Environment details (OS name and version, etc.)

Windows 11 Home 22H2 (compilation 22621.608)

Discussion:

Patch:
diff --git a/.changes/next-release/bugfix-docs-61070.json b/.changes/next-release/bugfix-docs-61070.json
new file mode 100644
index 000000000..b8005c2aa
--- /dev/null
+++ b/.changes/next-release/bugfix-docs-61070.json
@@ -0,0 +1,5 @@
+{
+  "type": "bugfix",
+  "category": "docs",
+  "description": "Fixes `#7338 <https://github.com/aws/aws-cli/issues/7338>`__. Remove global options from topic tags."
+}
diff --git a/awscli/clidocs.py b/awscli/clidocs.py
index 3f65041be..9d8fb9d59 100644
--- a/awscli/clidocs.py
+++ b/awscli/clidocs.py
@@ -655,6 +655,9 @@ class TopicListerDocumentEventHandler(CLIDocumentEventHandler):
     def doc_options_end(self, help_command, **kwargs):
         pass
 
+    def doc_global_option(self, help_command, **kwargs):
+        pass
+
     def doc_subitems_start(self, help_command, **kwargs):
         doc = help_command.doc
         doc.style.h2('Available Topics')


Test patch:
diff --git a/tests/unit/test_clidocs.py b/tests/unit/test_clidocs.py
index 600657310..be6a3ec7a 100644
--- a/tests/unit/test_clidocs.py
+++ b/tests/unit/test_clidocs.py
@@ -652,6 +652,11 @@ class TestTopicDocumentEventHandler(TestTopicDocumentEventHandlerBase):
         contents = self.cmd.doc.getvalue().decode('utf-8')
         self.assertIn(ref_body, contents)
 
+    def test_excludes_global_options(self):
+        self.doc_handler.doc_global_option(self.cmd)
+        global_options = self.cmd.doc.getvalue().decode('utf-8')
+        self.assertNotIn('Global Options', global_options)
+
 
 class TestGlobalOptionsDocumenter(unittest.TestCase):
     def create_help_command(self):