+ /**
+ * Get the output HTML
+ *
+ * @param array $options (since 1.31) Transformations to apply to the HTML
+ * - allowTOC: (bool) Show the TOC, assuming there were enough headings
+ * to generate one and `__NOTOC__` wasn't used. Default is true,
+ * but might be statefully overridden.
+ * - enableSectionEditLinks: (bool) Include section edit links, assuming
+ * section edit link tokens are present in the HTML. Default is true,
+ * but might be statefully overridden.
+ * @return string HTML
+ */
+ public function getText( $options = [] ) {
+ // @todo Warn if !array_key_exists( 'allowTOC', $options ) && empty( $this->mTOCEnabled )
+
+ // @todo Warn if !array_key_exists( 'enableSectionEditLinks', $options )
+ // && !$this->mEditSectionTokens
+ // Note that while $this->mEditSectionTokens formerly defaulted to false,
+ // ParserOptions->getEditSection() defaults to true and Parser copies
+ // that to us so true makes more sense as the stateless default.
+
+ $options += [
+ // empty() here because old cached versions might lack the field somehow.
+ // In that situation, the historical behavior (possibly buggy) is to remove the TOC.
+ 'allowTOC' => !empty( $this->mTOCEnabled ),
+ 'enableSectionEditLinks' => $this->mEditSectionTokens,
+ ];