# -*- coding: utf-8 -*-"""NodeDoc - Root document node for Atlassian Document Format (ADF).Reference: https://developer.atlassian.com/cloud/jira/platform/apis/document/nodes/doc/"""importtypingasTimportdataclassesfromfunc_args.apiimportREQfrom..type_enumimportTypeEnumfrom..mark_or_nodeimportBaseNodefrom..markdown_helpersimportdoc_content_to_markdownifT.TYPE_CHECKING:# pragma: no coverfrom.node_block_cardimportNodeBlockCardfrom.node_code_blockimportNodeCodeBlockfrom.node_media_singleimportNodeMediaSinglefrom.node_paragraphimportNodeParagraphfrom.node_task_listimportNodeTaskListfrom.node_ordered_listimportNodeOrderedListfrom.node_bullet_listimportNodeBulletListfrom.node_blockquoteimportNodeBlockquotefrom.node_decision_listimportNodeDecisionListfrom.node_embed_cardimportNodeEmbedCardfrom.node_extensionimportNodeExtensionfrom.node_headingimportNodeHeadingfrom.node_media_groupimportNodeMediaGroupfrom.node_ruleimportNodeRulefrom.node_panelimportNodePanelfrom.node_tableimportNodeTablefrom.node_expandimportNodeExpand
[docs]@dataclasses.dataclass(frozen=True)classNodeDoc(BaseNode):""" The root node of an ADF document. The doc node serves as the root container representing a document in the Atlassian Document Format (ADF). It is the top-level node that contains all other block-level nodes in a Confluence page or Jira issue field. :param version: The ADF specification version. Currently always 1. :param type: The node type, always "doc". :param content: List of top-level block nodes (paragraphs, headings, lists, tables, etc.). Reference: https://developer.atlassian.com/cloud/jira/platform/apis/document/nodes/doc/ """version:int=1type:str=TypeEnum.doc.valuecontent:list[T.Union["NodeBlockCard","NodeCodeBlock","NodeMediaSingle","NodeParagraph","NodeTaskList","NodeOrderedList","NodeBulletList","NodeBlockquote","NodeDecisionList","NodeEmbedCard","NodeExtension","NodeHeading","NodeMediaGroup","NodeRule","NodePanel","NodeTable","NodeExpand",]]=REQ
[docs]defto_markdown(self,ignore_error:bool=False,)->str:""" Convert the document to Markdown format. :param ignore_error: If True, silently skip nodes that fail to convert. :return: The complete document as Markdown text. """returndoc_content_to_markdown(self.content,ignore_error=ignore_error)