Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue #17397 by updating the markdown format in MarkdownReader #17429

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think following method could be better, because somethimes the name of image makes sense:
def remove_images(self, content: str) -> str:
"""Remove images in markdown content but keep the description."""
pattern = r"![(.?)](.?)"
return re.sub(pattern, r"\1", content)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. updated the function. These things happen sometimes.

Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def markdown_to_tups(self, markdown_text: str) -> List[Tuple[Optional[str], str]

def remove_images(self, content: str) -> str:
"""Remove images in markdown content."""
pattern = r"!{1}\[\[(.*)\]\]"
pattern = r"!\[.*?\]\(.*?\)"
return re.sub(pattern, "", content)

def remove_hyperlinks(self, content: str) -> str:
Expand Down
Loading