Skip to content

Commit

Permalink
[mlir][doc] Emit \n if description not end with \n.
Browse files Browse the repository at this point in the history
This PR addresses a markdown formatting issue by ensuring a `\n` is
emitted if the description string does not already end with one.
  • Loading branch information
CoTinker committed Oct 18, 2024
1 parent 3ef630a commit 56e5474
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mlir/tools/mlir-tblgen/OpDocGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ void mlir::tblgen::emitSummary(StringRef summary, raw_ostream &os) {
// nested in the op definition.
void mlir::tblgen::emitDescription(StringRef description, raw_ostream &os) {
raw_indented_ostream ros(os);
ros.printReindented(description.rtrim(" \t"));
StringRef trimmed = description.rtrim(" \t");
ros.printReindented(trimmed);
if (!trimmed.ends_with("\n"))
ros << "\n";
}

void mlir::tblgen::emitDescriptionComment(StringRef description,
Expand Down

0 comments on commit 56e5474

Please sign in to comment.