A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 08:30 UTC
Fix examples with code blocks in docs (#18609)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Harry Mellor committed
May 23, 2025 at 14:53 UTC
52fb23f47e043b9621d37322c1ca72b40bf721f7
1 file changed
+7
-4
docs/mkdocs/hooks/generate_examples.py
+7
-4
@@ -107,12 +107,15 @@ class Example:
107
content = f"---\ntitle: {self.title}\n---\n\n"
108
content += f"Source <gh-file:{self.path.relative_to(ROOT_DIR)}>.\n\n"
109
110
+ # Use long code fence to avoid issues with
111
+ # included files containing code fences too
112
+ code_fence = "``````"
113
is_code = self.main_file.suffix != ".md"
114
if is_code:
112
- content += f"```{self.main_file.suffix[1:]}\n"
115
+ content += f"{code_fence}{self.main_file.suffix[1:]}\n"
116
content += f'--8<-- "{self.main_file}"\n'
117
if is_code:
115
- content += "```\n"
118
+ content += f"{code_fence}\n"
119
content += "\n"
120
121
if not self.other_files:
@@ -122,10 +125,10 @@ class Example:
125
for file in sorted(self.other_files):
126
content += f'??? abstract "{file.relative_to(self.path)}"\n'
127
if file.suffix != ".md":
125
- content += f" ```{file.suffix[1:]}\n"
128
+ content += f" {code_fence}{file.suffix[1:]}\n"
129
content += f' --8<-- "{file}"\n'
130
if file.suffix != ".md":
128
- content += " ```\n"
131
+ content += f" {code_fence}\n"
132
133
return content
134