diff --git a/assets/How_to_build_dashboards_in_Grafana/image_06a8395b.png b/assets/How_to_build_dashboards_in_Grafana/image_06a8395b.png new file mode 100644 index 0000000..a9dc1b2 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_06a8395b.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_0730d859.png b/assets/How_to_build_dashboards_in_Grafana/image_0730d859.png new file mode 100644 index 0000000..9d54b08 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_0730d859.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_1515a4dd.png b/assets/How_to_build_dashboards_in_Grafana/image_1515a4dd.png new file mode 100644 index 0000000..de65b3e Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_1515a4dd.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_19e475a3.png b/assets/How_to_build_dashboards_in_Grafana/image_19e475a3.png new file mode 100644 index 0000000..55c32eb Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_19e475a3.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_1d0e8fea.png b/assets/How_to_build_dashboards_in_Grafana/image_1d0e8fea.png new file mode 100644 index 0000000..a52f428 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_1d0e8fea.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_1eff81c7.png b/assets/How_to_build_dashboards_in_Grafana/image_1eff81c7.png new file mode 100644 index 0000000..b413fdc Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_1eff81c7.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_1f866a33.png b/assets/How_to_build_dashboards_in_Grafana/image_1f866a33.png new file mode 100644 index 0000000..25729fb Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_1f866a33.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_20efab65.png b/assets/How_to_build_dashboards_in_Grafana/image_20efab65.png new file mode 100644 index 0000000..bbebc65 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_20efab65.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_215b094c.png b/assets/How_to_build_dashboards_in_Grafana/image_215b094c.png new file mode 100644 index 0000000..3fa15af Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_215b094c.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_388be087.png b/assets/How_to_build_dashboards_in_Grafana/image_388be087.png new file mode 100644 index 0000000..9ce6ad1 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_388be087.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_3b157c3f.png b/assets/How_to_build_dashboards_in_Grafana/image_3b157c3f.png new file mode 100644 index 0000000..1b03b27 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_3b157c3f.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_4d0fd9e9.png b/assets/How_to_build_dashboards_in_Grafana/image_4d0fd9e9.png new file mode 100644 index 0000000..2fb0766 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_4d0fd9e9.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_4e99a4b9.png b/assets/How_to_build_dashboards_in_Grafana/image_4e99a4b9.png new file mode 100644 index 0000000..30e012a Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_4e99a4b9.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_4ed35339.png b/assets/How_to_build_dashboards_in_Grafana/image_4ed35339.png new file mode 100644 index 0000000..86224ce Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_4ed35339.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_599b3d60.png b/assets/How_to_build_dashboards_in_Grafana/image_599b3d60.png new file mode 100644 index 0000000..f239d40 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_599b3d60.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_5e724387.png b/assets/How_to_build_dashboards_in_Grafana/image_5e724387.png new file mode 100644 index 0000000..a772baa Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_5e724387.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_61fdebf2.png b/assets/How_to_build_dashboards_in_Grafana/image_61fdebf2.png new file mode 100644 index 0000000..cb38284 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_61fdebf2.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_63584cb6.png b/assets/How_to_build_dashboards_in_Grafana/image_63584cb6.png new file mode 100644 index 0000000..590c2fd Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_63584cb6.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_67ceb203.png b/assets/How_to_build_dashboards_in_Grafana/image_67ceb203.png new file mode 100644 index 0000000..0e7b390 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_67ceb203.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_69df746f.png b/assets/How_to_build_dashboards_in_Grafana/image_69df746f.png new file mode 100644 index 0000000..467d277 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_69df746f.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_6fc42b49.png b/assets/How_to_build_dashboards_in_Grafana/image_6fc42b49.png new file mode 100644 index 0000000..5794b35 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_6fc42b49.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_72bb3b93.png b/assets/How_to_build_dashboards_in_Grafana/image_72bb3b93.png new file mode 100644 index 0000000..493f4af Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_72bb3b93.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_75c9ff24.png b/assets/How_to_build_dashboards_in_Grafana/image_75c9ff24.png new file mode 100644 index 0000000..4b7e390 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_75c9ff24.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_7cfddcc0.png b/assets/How_to_build_dashboards_in_Grafana/image_7cfddcc0.png new file mode 100644 index 0000000..36bc144 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_7cfddcc0.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_7f68830e.png b/assets/How_to_build_dashboards_in_Grafana/image_7f68830e.png new file mode 100644 index 0000000..df7a6bf Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_7f68830e.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_7fa839fa.png b/assets/How_to_build_dashboards_in_Grafana/image_7fa839fa.png new file mode 100644 index 0000000..efb0dfb Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_7fa839fa.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_811d738b.png b/assets/How_to_build_dashboards_in_Grafana/image_811d738b.png new file mode 100644 index 0000000..4679965 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_811d738b.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_8265f6f6.png b/assets/How_to_build_dashboards_in_Grafana/image_8265f6f6.png new file mode 100644 index 0000000..817fdf8 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_8265f6f6.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_8728c323.png b/assets/How_to_build_dashboards_in_Grafana/image_8728c323.png new file mode 100644 index 0000000..d7770c9 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_8728c323.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_9044743e.png b/assets/How_to_build_dashboards_in_Grafana/image_9044743e.png new file mode 100644 index 0000000..f9d8939 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_9044743e.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_9789f438.png b/assets/How_to_build_dashboards_in_Grafana/image_9789f438.png new file mode 100644 index 0000000..3511503 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_9789f438.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_992a81eb.png b/assets/How_to_build_dashboards_in_Grafana/image_992a81eb.png new file mode 100644 index 0000000..fb7d42f Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_992a81eb.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_a2cd3ad7.png b/assets/How_to_build_dashboards_in_Grafana/image_a2cd3ad7.png new file mode 100644 index 0000000..1611f46 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_a2cd3ad7.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_a35c985b.png b/assets/How_to_build_dashboards_in_Grafana/image_a35c985b.png new file mode 100644 index 0000000..1167113 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_a35c985b.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_a4ec2340.png b/assets/How_to_build_dashboards_in_Grafana/image_a4ec2340.png new file mode 100644 index 0000000..4c4a09d Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_a4ec2340.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_a67af661.png b/assets/How_to_build_dashboards_in_Grafana/image_a67af661.png new file mode 100644 index 0000000..5741f41 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_a67af661.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_a6eb424e.png b/assets/How_to_build_dashboards_in_Grafana/image_a6eb424e.png new file mode 100644 index 0000000..5da2978 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_a6eb424e.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_a72a3119.png b/assets/How_to_build_dashboards_in_Grafana/image_a72a3119.png new file mode 100644 index 0000000..fcfdfe7 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_a72a3119.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_b93b4896.png b/assets/How_to_build_dashboards_in_Grafana/image_b93b4896.png new file mode 100644 index 0000000..09c31d1 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_b93b4896.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_bcb7990f.png b/assets/How_to_build_dashboards_in_Grafana/image_bcb7990f.png new file mode 100644 index 0000000..d21a811 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_bcb7990f.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_bddc6188.png b/assets/How_to_build_dashboards_in_Grafana/image_bddc6188.png new file mode 100644 index 0000000..01bc17c Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_bddc6188.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_c67569b9.png b/assets/How_to_build_dashboards_in_Grafana/image_c67569b9.png new file mode 100644 index 0000000..91e178c Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_c67569b9.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_cb0adbe0.png b/assets/How_to_build_dashboards_in_Grafana/image_cb0adbe0.png new file mode 100644 index 0000000..bcff3a2 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_cb0adbe0.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_cf3e4717.png b/assets/How_to_build_dashboards_in_Grafana/image_cf3e4717.png new file mode 100644 index 0000000..ea73ec1 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_cf3e4717.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_cf65ef3a.png b/assets/How_to_build_dashboards_in_Grafana/image_cf65ef3a.png new file mode 100644 index 0000000..4775187 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_cf65ef3a.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_d445d171.png b/assets/How_to_build_dashboards_in_Grafana/image_d445d171.png new file mode 100644 index 0000000..0004860 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_d445d171.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_d5862bd6.png b/assets/How_to_build_dashboards_in_Grafana/image_d5862bd6.png new file mode 100644 index 0000000..285da27 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_d5862bd6.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_edd31b93.png b/assets/How_to_build_dashboards_in_Grafana/image_edd31b93.png new file mode 100644 index 0000000..6053e38 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_edd31b93.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_ef721677.png b/assets/How_to_build_dashboards_in_Grafana/image_ef721677.png new file mode 100644 index 0000000..1c6f1eb Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_ef721677.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_efe096c3.png b/assets/How_to_build_dashboards_in_Grafana/image_efe096c3.png new file mode 100644 index 0000000..293b5f9 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_efe096c3.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_f27cf4b4.png b/assets/How_to_build_dashboards_in_Grafana/image_f27cf4b4.png new file mode 100644 index 0000000..96cdf88 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_f27cf4b4.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_f3d0eaf9.png b/assets/How_to_build_dashboards_in_Grafana/image_f3d0eaf9.png new file mode 100644 index 0000000..beca826 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_f3d0eaf9.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_f762deef.png b/assets/How_to_build_dashboards_in_Grafana/image_f762deef.png new file mode 100644 index 0000000..24c0e62 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_f762deef.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_f89db983.png b/assets/How_to_build_dashboards_in_Grafana/image_f89db983.png new file mode 100644 index 0000000..036fe67 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_f89db983.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_f948c603.png b/assets/How_to_build_dashboards_in_Grafana/image_f948c603.png new file mode 100644 index 0000000..7fd11f6 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_f948c603.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_faf7a855.png b/assets/How_to_build_dashboards_in_Grafana/image_faf7a855.png new file mode 100644 index 0000000..288b4d7 Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_faf7a855.png differ diff --git a/assets/How_to_build_dashboards_in_Grafana/image_fd0acdd3.png b/assets/How_to_build_dashboards_in_Grafana/image_fd0acdd3.png new file mode 100644 index 0000000..f77f0ee Binary files /dev/null and b/assets/How_to_build_dashboards_in_Grafana/image_fd0acdd3.png differ diff --git a/packages/markitdown/src/markitdown/converters/_docx_converter.py b/packages/markitdown/src/markitdown/converters/_docx_converter.py index ac745ec..19ade96 100644 --- a/packages/markitdown/src/markitdown/converters/_docx_converter.py +++ b/packages/markitdown/src/markitdown/converters/_docx_converter.py @@ -1,6 +1,9 @@ import sys import os +import re +import unicodedata from typing import BinaryIO, Any +from io import BytesIO from ._html_converter import HtmlConverter from ..converter_utils.docx.pre_process import pre_process_docx @@ -51,6 +54,35 @@ class DocxConverter(HtmlConverter): return True return False + + def _sanitize_filename(self, filename: str) -> str: + """ + Sanitize a filename by removing or replacing problematic characters. + + Args: + filename: The original filename + + Returns: + A sanitized filename safe for filesystem use + """ + # Step 1: Normalize unicode characters + filename = unicodedata.normalize('NFKD', filename) + + # Step 2: Remove invalid characters and replace spaces with underscores + # Keep alphanumeric characters, underscores, hyphens, and periods + sanitized = re.sub(r'[^\w\-\.]', '_', filename) + + # Step 3: Collapse multiple underscores + sanitized = re.sub(r'_+', '_', sanitized) + + # Step 4: Remove leading/trailing underscores + sanitized = sanitized.strip('_') + + # Step 5: Ensure we have a valid filename (default if empty) + if not sanitized: + sanitized = "unnamed" + + return sanitized def _get_document_name(self, stream_info: StreamInfo) -> str: """ @@ -61,24 +93,21 @@ class DocxConverter(HtmlConverter): basename = os.path.basename(stream_info.filename) name, _ = os.path.splitext(basename) if name: - print(f"[DEBUG] Extracted document name from filename: {name}") - return name + return self._sanitize_filename(name) # If local_path exists, try to extract from local path if stream_info.local_path: basename = os.path.basename(stream_info.local_path) name, _ = os.path.splitext(basename) if name: - print(f"[DEBUG] Extracted document name from local_path: {name}") - return name + return self._sanitize_filename(name) # If URL exists, try to extract from URL if stream_info.url: basename = os.path.basename(stream_info.url) name, _ = os.path.splitext(basename) if name: - print(f"[DEBUG] Extracted document name from URL: {name}") - return name + return self._sanitize_filename(name) # Default name return "docx_document" @@ -88,10 +117,7 @@ class DocxConverter(HtmlConverter): file_stream: BinaryIO, stream_info: StreamInfo, **kwargs: Any, # Options to pass to the converter - ) -> DocumentConverterResult: - print(f"[DEBUG] DocxConverter.convert called with kwargs: {kwargs}") - print(f"[DEBUG] StreamInfo: filename={stream_info.filename}, local_path={stream_info.local_path}, url={stream_info.url}") - + ) -> DocumentConverterResult: # Check dependencies if _dependency_exc_info is not None: raise MissingDependencyException( @@ -110,7 +136,6 @@ class DocxConverter(HtmlConverter): if "conversion_name" not in kwargs: conversion_name = self._get_document_name(stream_info) kwargs["conversion_name"] = conversion_name - print(f"[DEBUG] Setting conversion_name to: {conversion_name}") style_map = kwargs.get("style_map", None) pre_process_stream = pre_process_docx(file_stream) @@ -124,7 +149,6 @@ class DocxConverter(HtmlConverter): extension=".html" ) - print(f"[DEBUG] Calling HTML converter with parameters: conversion_name={kwargs.get('conversion_name')}") # Use io.BytesIO to create binary stream from io import BytesIO return self._html_converter.convert( diff --git a/packages/markitdown/src/markitdown/converters/_markdownify.py b/packages/markitdown/src/markitdown/converters/_markdownify.py index 032abb8..914a38a 100644 --- a/packages/markitdown/src/markitdown/converters/_markdownify.py +++ b/packages/markitdown/src/markitdown/converters/_markdownify.py @@ -23,7 +23,7 @@ class _CustomMarkdownify(markdownify.MarkdownConverter): # Set default values for image-related options self.image_output_dir = options.get("image_output_dir", "assets") self.conversion_name = options.get("conversion_name") - + # Apply basic options options["heading_style"] = options.get("heading_style", markdownify.ATX) options["keep_data_uris"] = options.get("keep_data_uris", False) @@ -155,6 +155,10 @@ class _CustomMarkdownify(markdownify.MarkdownConverter): # Update src to relative path src = os.path.join(output_dir, filename).replace("\\", "/") + + # If alt text is empty, use the image filename (without extension) as alt text + if not alt: + alt = f"image_{hashname}" except Exception as e: error_msg = f"Error saving image: {str(e)}"