Markdown optimization (follow-up) The CL in [1] added a Markdown back-reference to documentation sections, but appended the suffix string unconditionally, even when not generting Markdown output. This polluted the command-line help, for example: ``` $ gn help clean gn clean <out_dir>... [Back to Top](#gn-reference) Deletes the contents of the output directory except for args.gn and creates a Ninja build environment sufficient to regenerate the build. ``` This CL fixes the situation by adding an `if (is_markdown)` test to cleanup the output. [1] https://gn-review.googlesource.com/c/gn/+/17420 Change-Id: Idd3fb6bd31caea84c7a105af334ae1eb69aae385 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/17560 Reviewed-by: Takuto Ikuta <tikuta@google.com> Commit-Queue: David Turner <digit@google.com>
diff --git a/src/gn/standard_out.cc b/src/gn/standard_out.cc index 2ff353c..85cd665 100644 --- a/src/gn/standard_out.cc +++ b/src/gn/standard_out.cc
@@ -310,7 +310,9 @@ OutputString(line.substr(0, chars_to_highlight), DECORATION_YELLOW); OutputString(line.substr(chars_to_highlight)); if (first_header) { - OutputString(" [Back to Top](#gn-reference)", DECORATION_NONE); + if (is_markdown) { + OutputString(" [Back to Top](#gn-reference)", DECORATION_NONE); + } first_header = false; } OutputString("\n");