mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-06-04 19:29:09 +08:00
Fix examples with code blocks in docs (#18609)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
parent
6dd51c7ef1
commit
52fb23f47e
@ -107,12 +107,15 @@ class Example:
|
|||||||
content = f"---\ntitle: {self.title}\n---\n\n"
|
content = f"---\ntitle: {self.title}\n---\n\n"
|
||||||
content += f"Source <gh-file:{self.path.relative_to(ROOT_DIR)}>.\n\n"
|
content += f"Source <gh-file:{self.path.relative_to(ROOT_DIR)}>.\n\n"
|
||||||
|
|
||||||
|
# Use long code fence to avoid issues with
|
||||||
|
# included files containing code fences too
|
||||||
|
code_fence = "``````"
|
||||||
is_code = self.main_file.suffix != ".md"
|
is_code = self.main_file.suffix != ".md"
|
||||||
if is_code:
|
if is_code:
|
||||||
content += f"```{self.main_file.suffix[1:]}\n"
|
content += f"{code_fence}{self.main_file.suffix[1:]}\n"
|
||||||
content += f'--8<-- "{self.main_file}"\n'
|
content += f'--8<-- "{self.main_file}"\n'
|
||||||
if is_code:
|
if is_code:
|
||||||
content += "```\n"
|
content += f"{code_fence}\n"
|
||||||
content += "\n"
|
content += "\n"
|
||||||
|
|
||||||
if not self.other_files:
|
if not self.other_files:
|
||||||
@ -122,10 +125,10 @@ class Example:
|
|||||||
for file in sorted(self.other_files):
|
for file in sorted(self.other_files):
|
||||||
content += f'??? abstract "{file.relative_to(self.path)}"\n'
|
content += f'??? abstract "{file.relative_to(self.path)}"\n'
|
||||||
if file.suffix != ".md":
|
if file.suffix != ".md":
|
||||||
content += f" ```{file.suffix[1:]}\n"
|
content += f" {code_fence}{file.suffix[1:]}\n"
|
||||||
content += f' --8<-- "{file}"\n'
|
content += f' --8<-- "{file}"\n'
|
||||||
if file.suffix != ".md":
|
if file.suffix != ".md":
|
||||||
content += " ```\n"
|
content += f" {code_fence}\n"
|
||||||
|
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user