[Mlir-commits] [mlir] [mlir][docgen] Add ops source link (PR #73657)

Mehdi Amini llvmlistbot at llvm.org
Wed Nov 29 02:17:46 PST 2023


================
@@ -265,10 +265,24 @@ static void emitOpDoc(const Operator &op, raw_ostream &os) {
   os << "\n";
 }
 
+static void emitSourceLink(StringRef inputFilename, raw_ostream &os) {
+  size_t pathBegin = inputFilename.find("mlir/include/mlir/");
+  if (pathBegin == StringRef::npos)
+    return;
+
+  StringRef inputFromMlirInclude = inputFilename.substr(pathBegin);
+
+  os << "<span class=\"op-definitions-source-link\">\n";
+  os << "  <a href=\"https://github.com/llvm/llvm-project/blob/main/"
+     << inputFromMlirInclude << "\">source</a>\n";
+  os << "</span>\n\n";
----------------
joker-eph wrote:

Is HTML just valid in Markdown like that?

https://github.com/llvm/llvm-project/pull/73657


More information about the Mlir-commits mailing list