From 56e54748ebda88f31d6b4f1cd45e7014a4d67823 Mon Sep 17 00:00:00 2001 From: Longsheng Mou Date: Fri, 18 Oct 2024 20:41:18 +0800 Subject: [PATCH] [mlir][doc] Emit `\n` if description not end with `\n`. This PR addresses a markdown formatting issue by ensuring a `\n` is emitted if the description string does not already end with one. --- mlir/tools/mlir-tblgen/OpDocGen.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mlir/tools/mlir-tblgen/OpDocGen.cpp b/mlir/tools/mlir-tblgen/OpDocGen.cpp index ff3c6b16bb6eb..d499c78a5cf44 100644 --- a/mlir/tools/mlir-tblgen/OpDocGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDocGen.cpp @@ -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,