pdftomd-url-tools 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wangneo276-lgtm
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,33 @@
1
+ Metadata-Version: 2.4
2
+ Name: pdftomd-url-tools
3
+ Version: 0.1.0
4
+ Summary: Free in-browser pdf to md tool. Drop a text PDF, preview Markdown, copy or download—files stay on your device. No account required.
5
+ Author: wangneo276-lgtm
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://pdftomd.tools/
8
+ Project-URL: Repository, https://github.com/wangneo276-lgtm/pdftomd-url-tools
9
+ Project-URL: Issues, https://github.com/wangneo276-lgtm/pdftomd-url-tools/issues
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ # pdftomd-url-tools
16
+
17
+ Builds canonical HTTPS URLs for pages that exist on [PDF to MD Converter](https://pdftomd.tools/).
18
+
19
+ Free in-browser pdf to md tool. Drop a text PDF, preview Markdown, copy or download—files stay on your device. No account required.
20
+
21
+ Not an official SDK. The helper only accepts paths that are already on the public site. It does not upload files or call the site.
22
+
23
+ ## Examples
24
+
25
+ - `canonicalUrl("/")` → https://pdftomd.tools/
26
+ - `canonicalUrl("https://pdftomd.tools/md-to-pdf?ref=1#top")` → https://pdftomd.tools/md-to-pdf
27
+ - `pageUrl("pdf-to-md")` → https://pdftomd.tools/pdf-to-md-converter
28
+ - `pageUrl("markdown-to-pdf")` → https://pdftomd.tools/markdown-to-pdf
29
+ - `blogUrl("convert-pdf-tables-to-markdown")` → https://pdftomd.tools/blog/convert-pdf-tables-to-markdown
30
+
31
+ Source: https://github.com/wangneo276-lgtm/pdftomd-url-tools
32
+
33
+ License: MIT.
@@ -0,0 +1,19 @@
1
+ # pdftomd-url-tools
2
+
3
+ Builds canonical HTTPS URLs for pages that exist on [PDF to MD Converter](https://pdftomd.tools/).
4
+
5
+ Free in-browser pdf to md tool. Drop a text PDF, preview Markdown, copy or download—files stay on your device. No account required.
6
+
7
+ Not an official SDK. The helper only accepts paths that are already on the public site. It does not upload files or call the site.
8
+
9
+ ## Examples
10
+
11
+ - `canonicalUrl("/")` → https://pdftomd.tools/
12
+ - `canonicalUrl("https://pdftomd.tools/md-to-pdf?ref=1#top")` → https://pdftomd.tools/md-to-pdf
13
+ - `pageUrl("pdf-to-md")` → https://pdftomd.tools/pdf-to-md-converter
14
+ - `pageUrl("markdown-to-pdf")` → https://pdftomd.tools/markdown-to-pdf
15
+ - `blogUrl("convert-pdf-tables-to-markdown")` → https://pdftomd.tools/blog/convert-pdf-tables-to-markdown
16
+
17
+ Source: https://github.com/wangneo276-lgtm/pdftomd-url-tools
18
+
19
+ License: MIT.
@@ -0,0 +1,21 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pdftomd-url-tools"
7
+ version = "0.1.0"
8
+ description = 'Free in-browser pdf to md tool. Drop a text PDF, preview Markdown, copy or download—files stay on your device. No account required.'
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ authors = [{ name = "wangneo276-lgtm" }]
13
+
14
+ [project.urls]
15
+ Homepage = "https://pdftomd.tools/"
16
+ Repository = "https://github.com/wangneo276-lgtm/pdftomd-url-tools"
17
+ Issues = "https://github.com/wangneo276-lgtm/pdftomd-url-tools/issues"
18
+
19
+ [tool.setuptools.packages.find]
20
+ where = ["python"]
21
+ include = ["pdftomd_url_tools*"]
@@ -0,0 +1,73 @@
1
+ from __future__ import annotations
2
+
3
+ ORIGIN = 'https://pdftomd.tools'
4
+ DESCRIPTION = 'Free in-browser pdf to md tool. Drop a text PDF, preview Markdown, copy or download—files stay on your device. No account required.'
5
+ PATHS = {'/blog/best-document-format-for-chatgpt', '/blog/markdown-to-pdf-page-breaks', '/pdf-to-markdown-obsidian', '/blog/print-markdown-to-pdf-with-tables', '/blog/convert-pdf-tables-to-markdown', '/blog', '/pdf-to-markdown-python', '/batch-pdf-to-markdown', '/blog/convert-pdf-to-markdown-without-losing-formatting', '/terms-of-service', '/markdown-to-pdf', '/about', '/md-to-pdf', '/pdf-to-markdown-for-llm', '/blog/convert-multiple-pdfs-to-markdown', '/blog/convert-pdf-to-markdown-locally', '/convert-pdf-to-md', '/', '/pdf-to-md-converter', '/blog/import-pdf-into-obsidian-as-notes', '/blog/pymupdf4llm-vs-pdfplumber-vs-marker', '/privacy-policy'}
6
+ PAGES = {'home': '/', 'pdf-to-md': '/pdf-to-md-converter', 'convert': '/convert-pdf-to-md', 'md-to-pdf': '/md-to-pdf', 'markdown-to-pdf': '/markdown-to-pdf', 'llm': '/pdf-to-markdown-for-llm', 'batch': '/batch-pdf-to-markdown', 'obsidian': '/pdf-to-markdown-obsidian', 'python': '/pdf-to-markdown-python', 'about': '/about', 'privacy': '/privacy-policy', 'terms': '/terms-of-service', 'blog': '/blog'}
7
+ BLOGS = {'pymupdf4llm-vs-pdfplumber-vs-marker': '/blog/pymupdf4llm-vs-pdfplumber-vs-marker', 'import-pdf-into-obsidian-as-notes': '/blog/import-pdf-into-obsidian-as-notes', 'convert-multiple-pdfs-to-markdown': '/blog/convert-multiple-pdfs-to-markdown', 'convert-pdf-to-markdown-locally': '/blog/convert-pdf-to-markdown-locally', 'markdown-to-pdf-page-breaks': '/blog/markdown-to-pdf-page-breaks', 'best-document-format-for-chatgpt': '/blog/best-document-format-for-chatgpt', 'convert-pdf-to-markdown-without-losing-formatting': '/blog/convert-pdf-to-markdown-without-losing-formatting', 'print-markdown-to-pdf-with-tables': '/blog/print-markdown-to-pdf-with-tables', 'convert-pdf-tables-to-markdown': '/blog/convert-pdf-tables-to-markdown'}
8
+ HOST = 'pdftomd.tools'
9
+
10
+
11
+ def canonical_url(value: str) -> str:
12
+ if not isinstance(value, str):
13
+ raise ValueError("path required")
14
+ raw = value.strip()
15
+ if not raw:
16
+ raise ValueError("path required")
17
+ if "\\" in raw or "%" in raw:
18
+ raise ValueError("invalid path")
19
+ raw = raw.split("#", 1)[0].split("?", 1)[0]
20
+ lower = raw.lower()
21
+ if lower.startswith("https://") or lower.startswith("http://") or raw.startswith("//"):
22
+ if lower.startswith("https://"):
23
+ rest = raw[len("https://"):]
24
+ elif lower.startswith("http://"):
25
+ rest = raw[len("http://"):]
26
+ else:
27
+ rest = raw[2:]
28
+ slash = rest.find("/")
29
+ hostport = rest if slash < 0 else rest[:slash]
30
+ path = "/" if slash < 0 else rest[slash:]
31
+ if "@" in hostport:
32
+ raise ValueError("userinfo not allowed")
33
+ if ":" in hostport:
34
+ raise ValueError("port not allowed")
35
+ if hostport.lower() != HOST:
36
+ raise ValueError("host not allowed")
37
+ elif raw.startswith("/"):
38
+ path = raw
39
+ else:
40
+ path = "/" + raw
41
+ while "//" in path:
42
+ path = path.replace("//", "/")
43
+ path = path.lower()
44
+ for seg in path.split("/"):
45
+ if seg in {".", ".."}:
46
+ raise ValueError("path traversal")
47
+ if len(path) > 1:
48
+ path = path.rstrip("/")
49
+ if path == "":
50
+ path = "/"
51
+ if path not in PATHS:
52
+ raise ValueError("unknown path: " + path)
53
+ return ORIGIN + "/" if path == "/" else ORIGIN + path
54
+
55
+
56
+ def home_url() -> str:
57
+ return canonical_url("/")
58
+
59
+
60
+ def page_url(name: str) -> str:
61
+ if name not in PAGES:
62
+ raise ValueError("unknown page: " + name)
63
+ return canonical_url(PAGES[name])
64
+
65
+
66
+ def blog_url(slug: str) -> str:
67
+ if slug not in BLOGS:
68
+ raise ValueError("unknown blog: " + slug)
69
+ return canonical_url(BLOGS[slug])
70
+
71
+
72
+ def metadata() -> dict:
73
+ return {"name": "PDF to MD Converter", "homepage": home_url(), "description": DESCRIPTION}
@@ -0,0 +1,33 @@
1
+ Metadata-Version: 2.4
2
+ Name: pdftomd-url-tools
3
+ Version: 0.1.0
4
+ Summary: Free in-browser pdf to md tool. Drop a text PDF, preview Markdown, copy or download—files stay on your device. No account required.
5
+ Author: wangneo276-lgtm
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://pdftomd.tools/
8
+ Project-URL: Repository, https://github.com/wangneo276-lgtm/pdftomd-url-tools
9
+ Project-URL: Issues, https://github.com/wangneo276-lgtm/pdftomd-url-tools/issues
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ # pdftomd-url-tools
16
+
17
+ Builds canonical HTTPS URLs for pages that exist on [PDF to MD Converter](https://pdftomd.tools/).
18
+
19
+ Free in-browser pdf to md tool. Drop a text PDF, preview Markdown, copy or download—files stay on your device. No account required.
20
+
21
+ Not an official SDK. The helper only accepts paths that are already on the public site. It does not upload files or call the site.
22
+
23
+ ## Examples
24
+
25
+ - `canonicalUrl("/")` → https://pdftomd.tools/
26
+ - `canonicalUrl("https://pdftomd.tools/md-to-pdf?ref=1#top")` → https://pdftomd.tools/md-to-pdf
27
+ - `pageUrl("pdf-to-md")` → https://pdftomd.tools/pdf-to-md-converter
28
+ - `pageUrl("markdown-to-pdf")` → https://pdftomd.tools/markdown-to-pdf
29
+ - `blogUrl("convert-pdf-tables-to-markdown")` → https://pdftomd.tools/blog/convert-pdf-tables-to-markdown
30
+
31
+ Source: https://github.com/wangneo276-lgtm/pdftomd-url-tools
32
+
33
+ License: MIT.
@@ -0,0 +1,8 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ python/pdftomd_url_tools/__init__.py
5
+ python/pdftomd_url_tools.egg-info/PKG-INFO
6
+ python/pdftomd_url_tools.egg-info/SOURCES.txt
7
+ python/pdftomd_url_tools.egg-info/dependency_links.txt
8
+ python/pdftomd_url_tools.egg-info/top_level.txt
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+