Skip to content

Commit ffce1f7

Browse files
authored
Fix spacing between subsequent headings for markdown generation (#1334)
* fix: Fix spacing to prevent consecutive headings from rendering incorrectly. * also add newlines after records,flags,variant and enum
1 parent 7f92598 commit ffce1f7

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

crates/markdown/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ impl InterfaceGenerator<'_> {
428428
fn docs(&mut self, docs: &Docs) {
429429
let docs = match &docs.contents {
430430
Some(docs) => docs,
431-
None => return,
431+
None => "\n",
432432
};
433433
for line in docs.lines() {
434434
self.push_str(line.trim());
@@ -484,6 +484,7 @@ impl<'a> wit_bindgen_core::InterfaceGenerator<'a> for InterfaceGenerator<'a> {
484484
}
485485
self.push_str("\n");
486486
}
487+
self.push_str("\n");
487488
}
488489

489490
fn type_resource(&mut self, _id: TypeId, name: &str, docs: &Docs) {
@@ -511,6 +512,7 @@ impl<'a> wit_bindgen_core::InterfaceGenerator<'a> for InterfaceGenerator<'a> {
511512
self.print_ty(ty);
512513
self.push_str("\n");
513514
}
515+
self.push_str("\n");
514516
}
515517

516518
fn type_flags(&mut self, _id: TypeId, name: &str, flags: &Flags, docs: &Docs) {
@@ -537,6 +539,7 @@ impl<'a> wit_bindgen_core::InterfaceGenerator<'a> for InterfaceGenerator<'a> {
537539
}
538540
self.push_str("\n");
539541
}
542+
self.push_str("\n");
540543
}
541544

542545
fn type_variant(&mut self, _id: TypeId, name: &str, variant: &Variant, docs: &Docs) {
@@ -567,6 +570,7 @@ impl<'a> wit_bindgen_core::InterfaceGenerator<'a> for InterfaceGenerator<'a> {
567570
}
568571
self.push_str("\n");
569572
}
573+
self.push_str("\n");
570574
}
571575

572576
fn type_enum(&mut self, _id: TypeId, name: &str, enum_: &Enum, docs: &Docs) {
@@ -593,6 +597,7 @@ impl<'a> wit_bindgen_core::InterfaceGenerator<'a> for InterfaceGenerator<'a> {
593597
}
594598
self.push_str("\n");
595599
}
600+
self.push_str("\n");
596601
}
597602

598603
fn type_option(&mut self, _id: TypeId, name: &str, payload: &Type, docs: &Docs) {

0 commit comments

Comments
 (0)