from raghilda.read import read_as_markdown
# Read from a local file
md_content = read_as_markdown("path/to/file.md")
print(md_content)
# Read from an HTTP URL
md_content = read_as_markdown("https://raw.githubusercontent.com/user/repo/branch/file.md")
print(md_content)read.read_as_markdown()
Read a markdown file from a URI and return its content as a string.
Usage
read.read_as_markdown(
uri, html_extract_selectors=None, html_zap_selectors=None, *args, **kwargs
)Parameters
uri: str-
The URI of the markdown file to read. Supported schemes are:
- path/to/file.md
- http://example.com/file.md
- https://example.com/file.md
html_extract_selectors: Optional[list[str]] = None-
A list of CSS selectors to extract specific parts of the HTML content when the URI points to an HTML page. Defaults to [‘main’].
html_zap_selectors: Optional[list[str]] = None- A list of CSS selectors to remove specific parts of the HTML content when the URI points to an HTML page. Defaults to [‘nav’].
Returns
MarkdownDocument- The content of the markdown file as a MarkdownDocument object.