classMkText(mknode.MkNode):"""Class for any Markup text. All classes inheriting from MkNode can get converted to this Type. """ICON="material/text"def__init__(self,text:str|mknode.MkNode|None="",*,render_jinja:bool=False,**kwargs:Any,):"""Constructor. Arguments: text: Markup text render_jinja: Whether text should get rendered by this node kwargs: Keyword arguments passed to parent """super().__init__(**kwargs)self._text=str(textor"")self.render_jinja=render_jinjadef__getitem__(self,section_name:str)->Self|None:markdown=self._to_markdown()section_text=mdfilters.extract_header_section(markdown,section_name)returnNoneifsection_textisNoneelsetype(self)(section_text)@propertydeftext(self)->str:ifnotself.render_jinja:returnself._textreturnself.env.render_string(self._text)@text.setterdeftext(self,value):self._text=valuedef_to_markdown(self)->str:returnself.text@propertydefchildren(self):ifnotself.render_jinja:return[]self.env.render_string(self._text,variables=self.variables)returnself.env.rendered_children@children.setterdefchildren(self,val):pass@classmethoddeffrom_url(cls,url:str)->Self|None:"""Build a MkText node on a remote markup file. If the URL contains a "#" (http://.../markdown.md#section), it will try to extract the given section. All fsspec protocols are supported as URL. Arguments: url: URL to get markdown from. """url,*section=url.split("#")text=pathhelpers.load_file_cached(url)ifsection:text=mdfilters.extract_header_section(text,section[0])returncls(text)iftextisnotNoneelseNone