Skip to content

Commit 3f2e047

Browse files
authored
Merge pull request #3810 from handrews/appendix
Correctly handle appendicies in md2html
2 parents 994a851 + 29fdf6f commit 3f2e047

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: scripts/md2html/md2html.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -293,18 +293,22 @@ for (let l in lines) {
293293
//if (delta<0) delta = -1;
294294
if (Math.abs(delta)>1) console.warn(delta,line);
295295
let prefix = '';
296+
let newSection = '<section>';
297+
if (line.includes('Appendix')) {
298+
newSection = '<section class="appendix">';
299+
}
296300

297301
// heading level delta is either 0 or is +1/-1, or we're in respec mode
298302
/* respec insists on <section>...</section> breaks around headings */
299303

300304
if (delta === 0) {
301-
prefix = '</section><section>';
305+
prefix = '</section>'+newSection;
302306
}
303307
else if (delta > 0) {
304-
prefix = '<section>'.repeat(delta);
308+
prefix = newSection.repeat(delta);
305309
}
306310
else {
307-
prefix = '</section>'+('</section>').repeat(Math.abs(delta))+'<section>';
311+
prefix = '</section>'+('</section>').repeat(Math.abs(delta))+newSection;
308312
}
309313
prevHeading = heading;
310314
line = prefix+md.render(line);

0 commit comments

Comments
 (0)