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

updated the README, still need to update the docsa #457

Closed
wants to merge 1 commit into from
Closed
Changes from all 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
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,31 @@ More [detailed installation instructions](https://ds4sd.github.io/docling/instal
To convert individual documents, use `convert()`, for example:

```python
from docling_core.types.doc.base import ImageRefMode
from docling_core.types.doc.document import DoclingDocument

from docling.document_converter import DocumentConverter

source = "https://arxiv.org/pdf/2408.09869" # document per local path or URL
converter = DocumentConverter()
result = converter.convert(source)
print(result.document.export_to_markdown()) # output: "## Docling Technical Report[...]"

doc: DoclingDocument = result.document

# returning the document in-memory
print(doc.export_to_markdown()) # output: "## Docling Technical Report[...]"
print(doc.export_to_html()) # output: "<h1>Docling Technical Report[...]"

# save document to disk, keep only placeholders for images
doc.save_as_markdown(filename="output_pl.md", image_mode=ImageRefMode.PLACEHOLDER)

# save document to disk, embed images in base64
doc.save_as_markdown(filename="output_emb.md", image_mode=ImageRefMode.EMBEDDED)
doc.save_as_html(filename="output_emb.html", image_mode=ImageRefMode.EMBEDDED)

# save document to disk, save images in PNG format and reference them in markdown
doc.save_as_markdown(filename="output_ref.md", image_mode=ImageRefMode.REFERENCED)
doc.save_as_html(filename="output_ref.html", image_mode=ImageRefMode.REFERENCED)
```

Check out [Getting started](https://ds4sd.github.io/docling/).
Expand Down