MCPcopy
hub / github.com/mkdocs/mkdocs / handle_data

Method handle_data

mkdocs/contrib/search/search_index.py:204–221  ·  view source on GitHub ↗

Called for the text contents of each tag.

(self, data: str)

Source from the content-addressed store, hash-verified

202 self.is_header_tag = False
203
204 def handle_data(self, data: str) -> None:
205 """Called for the text contents of each tag."""
206 self._stripped_html.append(data)
207
208 if self.section is None:
209 # This means we have some content at the start of the
210 # HTML before we reach a heading tag. We don't actually
211 # care about that content as it will be added to the
212 # overall page entry in the search. So just skip it.
213 return
214
215 # If this is a header, then the data is the title.
216 # Otherwise it is content of something under that header
217 # section.
218 if self.is_header_tag:
219 self.section.title = data
220 else:
221 self.section.text.append(data.rstrip('\n'))
222
223 @property
224 def stripped_html(self) -> str:

Callers

nothing calls this directly

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected