"`pip install markdownify`"
                )
        else:
            try:
                from bs4 import BeautifulSoup  # type: ignore
            except ImportError:
                raise ImportError(
                    "`beautifulsoup4` package not found, please run "
                    "`pip install beautifulsoup4`"
                )
        if include_attachments:
            attachment_texts = self.process_attachment(page["id"], ocr_languages)
        else:
            attachment_texts = []
        if keep_markdown_format:
            # Use markdownify to keep the page Markdown style
            text = markdownify(
                page["body"]["storage"]["value"], heading_style="ATX"
            ) + "".join(attachment_texts)
        else:
            content = content_format.get_content(page)
            text = BeautifulSoup(content, "lxml").get_text(" ", strip=True) + "".join(
                attachment_texts
            )
        if include_comments:
            comments = self.confluence.get_page_comments(
                page["id"], expand="body.view.value", depth="all"
            )["results"]
            comment_texts = [
                BeautifulSoup(comment["body"]["view"]["value"], "lxml").get_text(
                    " ", strip=True
                )
                for comment in comments
            ]
            text = text + "".join(comment_texts)
        return Document(
            page_content=text,
            metadata={
                "title": page["title"],
                "id": page["id"],
                "source": self.base_url.strip("/") + page["_links"]["webui"],
            },
        )
[docs]    def process_attachment(
        self,
        page_id: str,
        ocr_languages: Optional[str] = None,
    ) -> List[str]:
        try: