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 prompt to extract text and format it in Markdown, including a… #200

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dzemeuksis
Copy link

Updated prompt to extract text and format it in Markdown, including additional visual details, instead of only describing the image.

The markitdown module is designed to extract text from various documents and save it in Markdown format, as stated in its purpose. This change aligns the default behavior of image processing with the overall goal of the module.

Previously, providing an image resulted in a plain text description, which likely did not meet user expectations. Users are more likely to expect extracted text and formatting when supplying an image, making this change a better fit for the module's intended functionality.

…dditional visual details, instead of only describing the image.
@dzemeuksis
Copy link
Author

@microsoft-github-policy-service agree

@PetrAPConsulting
Copy link
Contributor

PetrAPConsulting commented Jan 6, 2025

Hi @dzemeuksis,
I have similar suggestion. I am using this prompt (varified wit GPT 4o) which cover the most pictures embedded in the documents. I do not want to open separate pull request and yours is the most suitable to propose it.

"""Convert this image into a structured markdown representation that preserves its data and relationships. Follow these conversion guidelines based on content type:

For Tables:
Create a proper markdown table with headers and data rows. For example:

Column1 Column2
Data1 Data2

For Mathematical Formulas:
Use LaTeX notation within markdown delimiters. For example:
$$ y = mx + b $$

For Charts and Graphs:

  1. Extract the actual data points and represent them in a markdown table
  2. Include axis labels, units, and scale information
  3. Describe the relationship pattern (linear, exponential, etc.) as a markdown header

For Flowcharts and Diagrams:
Convert to mermaid markdown syntax when possible:

graph LR
    A-->B
    B-->C
Loading

For Process Flows:
Create a numbered list with clear step progression and any branching conditions.

For Technical Diagrams:

  1. Create a hierarchical structure using markdown headers
  2. List components and their relationships
  3. Preserve any measurements or specifications in tables

Additional Guidelines:

  • Maintain numerical precision exactly as shown
  • Preserve all labels and annotations as markdown text
  • Include metadata as key-value pairs at the top
  • Use markdown quotes for any explanatory text
  • Structure the output to prioritize machine readability
  • Preserve relationships between data elements using markdown hierarchy"""

Let me know if you see it as reasonable to push it together.

Petr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants