File tree 1 file changed +7
-4
lines changed 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -107,12 +107,15 @@ def generate(self) -> str:
107
107
content = f"---\n title: { self .title } \n ---\n \n "
108
108
content += f"Source <gh-file:{ self .path .relative_to (ROOT_DIR )} >.\n \n "
109
109
110
+ # Use long code fence to avoid issues with
111
+ # included files containing code fences too
112
+ code_fence = "``````"
110
113
is_code = self .main_file .suffix != ".md"
111
114
if is_code :
112
- content += f"``` { self .main_file .suffix [1 :]} \n "
115
+ content += f"{ code_fence } { self .main_file .suffix [1 :]} \n "
113
116
content += f'--8<-- "{ self .main_file } "\n '
114
117
if is_code :
115
- content += "``` \n "
118
+ content += f" { code_fence } \n "
116
119
content += "\n "
117
120
118
121
if not self .other_files :
@@ -122,10 +125,10 @@ def generate(self) -> str:
122
125
for file in sorted (self .other_files ):
123
126
content += f'??? abstract "{ file .relative_to (self .path )} "\n '
124
127
if file .suffix != ".md" :
125
- content += f" ``` { file .suffix [1 :]} \n "
128
+ content += f" { code_fence } { file .suffix [1 :]} \n "
126
129
content += f' --8<-- "{ file } "\n '
127
130
if file .suffix != ".md" :
128
- content += " ``` \n "
131
+ content += f " { code_fence } \n "
129
132
130
133
return content
131
134
You can’t perform that action at this time.
0 commit comments