Source code for atlas_doc_parser.nodes.node_expand
# -*- coding: utf-8 -*-importtypingasTimportdataclassesfromfunc_args.apiimportREQ,OPTfrom..type_enumimportTypeEnumfrom..mark_or_nodeimportBase,BaseNodefrom..markdown_helpersimportdoc_content_to_markdown,add_style_to_markdownifT.TYPE_CHECKING:# pragma: no coverfrom.node_paragraphimportNodeParagraphfrom.node_panelimportNodePanelfrom.node_blockquoteimportNodeBlockquotefrom.node_ordered_listimportNodeOrderedListfrom.node_bullet_listimportNodeBulletListfrom.node_ruleimportNodeRulefrom.node_headingimportNodeHeadingfrom.node_code_blockimportNodeCodeBlockfrom.node_media_groupimportNodeMediaGroupfrom.node_media_singleimportNodeMediaSinglefrom.node_decision_listimportNodeDecisionListfrom.node_task_listimportNodeTaskListfrom.node_tableimportNodeTablefrom.node_block_cardimportNodeBlockCardfrom.node_embed_cardimportNodeEmbedCardfrom.node_extensionimportNodeExtensionfrom.node_nested_expandimportNodeNestedExpand
[docs]@dataclasses.dataclass(frozen=True)classNodeExpandAttrs(Base):""" Attributes for :class:`NodeExpand`. :param title: Optional. Display title for the expand container. :param localId: Optional. A unique identifier for the node. """title:str=OPTlocalId:str=OPT
[docs]@dataclasses.dataclass(frozen=True)classNodeExpand(BaseNode):""" A container that enables content to be hidden or shown. The expand node is a top-level block node similar to an accordion or disclosure widget. It contains block-level content that can be toggled visible or hidden by the user. Note: For table cells or headers, use nestedExpand instead of expand. - https://developer.atlassian.com/cloud/jira/platform/apis/document/nodes/expand/ """type:str=TypeEnum.expand.valueattrs:NodeExpandAttrs=OPTcontent:list[T.Union["NodeParagraph","NodePanel","NodeBlockquote","NodeOrderedList","NodeBulletList","NodeRule","NodeHeading","NodeCodeBlock","NodeMediaGroup","NodeMediaSingle","NodeDecisionList","NodeTaskList","NodeTable","NodeBlockCard","NodeEmbedCard","NodeExtension","NodeNestedExpand",]]=REQ
[docs]defto_markdown(self,ignore_error:bool=False,)->str:""" .. note:: When converting an expand node to Markdown, any nested expand nodes are treated as regular expand nodes without preserving their hierarchical structure. """md=doc_content_to_markdown(content=self.content,ignore_error=ignore_error)md=add_style_to_markdown(md,self)returnmd