Create proto format flag on Stardoc to output raw form of protos.

Progress toward https://github.com/bazelbuild/skydoc/issues/189

RELNOTES: None.
PiperOrigin-RevId: 253281526
diff --git a/src/test/java/com/google/devtools/build/skydoc/BUILD b/src/test/java/com/google/devtools/build/skydoc/BUILD
index e3bab00..6172dbf 100644
--- a/src/test/java/com/google/devtools/build/skydoc/BUILD
+++ b/src/test/java/com/google/devtools/build/skydoc/BUILD
@@ -38,6 +38,14 @@
 )
 
 skydoc_test(
+    name = "proto_format_test",
+    format = "proto",
+    golden_file = "testdata/proto_format_test/golden.raw",
+    input_file = "testdata/proto_format_test/input.bzl",
+    skydoc = "//src/main/java/com/google/devtools/build/skydoc",
+)
+
+skydoc_test(
     name = "cc_api_test",
     golden_file = "testdata/cc_api_test/golden.txt",
     input_file = "testdata/cc_api_test/input.bzl",
diff --git a/src/test/java/com/google/devtools/build/skydoc/skydoc_test.bzl b/src/test/java/com/google/devtools/build/skydoc/skydoc_test.bzl
index eda5e02..3f0f964 100644
--- a/src/test/java/com/google/devtools/build/skydoc/skydoc_test.bzl
+++ b/src/test/java/com/google/devtools/build/skydoc/skydoc_test.bzl
@@ -30,7 +30,8 @@
         skydoc,
         deps = [],
         whitelisted_symbols = [],
-        semantic_flags = []):
+        semantic_flags = [],
+        format = "markdown"):
     """Creates a test target and golden-file regeneration target for skydoc testing.
 
     The test target is named "{name}_e2e_test".
@@ -53,6 +54,7 @@
           <code>//foo:bar.bzl</code> does not build except when a user would specify
           <code>--incompatible_foo_semantic=false</code>, then this attribute should contain
           "--incompatible_foo_semantic=false"
+      format: The format of the output file.
     """
     actual_generated_doc = "%s_output.txt" % name
 
@@ -87,4 +89,5 @@
         deps = ["%s_lib" % name],
         stardoc = skydoc,
         semantic_flags = semantic_flags,
+        format = format,
     )
diff --git a/src/test/java/com/google/devtools/build/skydoc/testdata/proto_format_test/golden.raw b/src/test/java/com/google/devtools/build/skydoc/testdata/proto_format_test/golden.raw
new file mode 100644
index 0000000..f80ac07
--- /dev/null
+++ b/src/test/java/com/google/devtools/build/skydoc/testdata/proto_format_test/golden.raw
@@ -0,0 +1,14 @@
+
+q
+Small example of rule.*
+nameA unique name for this target. +
+uselessThis argument will be ignored.Œ
+$Stores information about an example. 
+fooA string representing foo 
+barA string representing bar 
+bazA string representing bazÆ
+check_function%
+fooA unique name for this rule. ŒRuns some checks on the given function parameter.
+
+This rule runs checks on a given function parameter.
+Use `bazel build` to run the check.
diff --git a/src/test/java/com/google/devtools/build/skydoc/testdata/proto_format_test/input.bzl b/src/test/java/com/google/devtools/build/skydoc/testdata/proto_format_test/input.bzl
new file mode 100644
index 0000000..875992d
--- /dev/null
+++ b/src/test/java/com/google/devtools/build/skydoc/testdata/proto_format_test/input.bzl
@@ -0,0 +1,35 @@
+"""Input file for proto format test"""
+
+def check_function(foo):
+    """Runs some checks on the given function parameter.
+
+    This rule runs checks on a given function parameter.
+    Use `bazel build` to run the check.
+
+    Args:
+        foo: A unique name for this rule.
+    """
+    pass
+
+example = provider(
+    doc = "Stores information about an example.",
+    fields = {
+        "foo": "A string representing foo",
+        "bar": "A string representing bar",
+        "baz": "A string representing baz",
+    },
+)
+
+def _rule_impl(ctx):
+    print("Hello World")
+
+my_example = rule(
+    implementation = _rule_impl,
+    doc = "Small example of rule.",
+    attrs = {
+        "useless": attr.string(
+            doc = "This argument will be ignored.",
+            default = "ignoreme",
+        ),
+    },
+)