Skip to content

Inline <style> and <link> support#2

Open
FurryR wants to merge 2 commits into
francozanardi:mainfrom
FurryR:main
Open

Inline <style> and <link> support#2
FurryR wants to merge 2 commits into
francozanardi:mainfrom
FurryR:main

Conversation

@FurryR

@FurryR FurryR commented Jan 19, 2026

Copy link
Copy Markdown

Implements #1.

Caveat

  • When using <link>, CSS3 @import syntax is not supported (there's also problems on URL handling). However it is unable to fix the caveat without making REALLY huge changes, so I will just leave it. Maybe you should add a todo for it.

Relevant possibly incompatible changes

My package manager is unable to resolve all the dependencies under Python version >=3.8. I bumped it to >=3.9 for fix. This may result in incompatibility.

Detailed output (pdm):

❯ pdm install
WARNING: Lockfile does not exist
Updating the lock file...
INFO: Virtualenv /home/(redacted)/html2pic/.venv is reused.
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping pictex@2.0.1 because it requires
Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of pictex that supports Python>=3.8
will be used.
If you want to install pictex@2.0.1, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping pictex@2.0.0 because it requires
Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of pictex that supports Python>=3.8
will be used.
If you want to install pictex@2.0.0, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping tinycss2@1.5.1 because it
requires Python>=3.10 but the lock targets to work with Python>=3.8. Instead, another version of tinycss2 that supports
Python>=3.8 will be used.
If you want to install tinycss2@1.5.1, narrow down the `requires-python` range to include this version. For example,
">=3.10" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping tinycss2@1.5.0 because it
requires Python>=3.10 but the lock targets to work with Python>=3.8. Instead, another version of tinycss2 that supports
Python>=3.8 will be used.
If you want to install tinycss2@1.5.0, narrow down the `requires-python` range to include this version. For example,
">=3.10" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping soupsieve@2.8.2 because it
requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of soupsieve that supports
Python>=3.8 will be used.
If you want to install soupsieve@2.8.2, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping soupsieve@2.8.1 because it
requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of soupsieve that supports
Python>=3.8 will be used.
If you want to install soupsieve@2.8.1, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping soupsieve@2.8 because it requires
Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of soupsieve that supports
Python>=3.8 will be used.
If you want to install soupsieve@2.8, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping typing-extensions@4.15.0 because
it requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of typing-extensions
that supports Python>=3.8 will be used.
If you want to install typing-extensions@4.15.0, narrow down the `requires-python` range to include this version. For
example, ">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping typing-extensions@4.14.1 because
it requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of typing-extensions
that supports Python>=3.8 will be used.
If you want to install typing-extensions@4.14.1, narrow down the `requires-python` range to include this version. For
example, ">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping typing-extensions@4.14.0 because
it requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of typing-extensions
that supports Python>=3.8 will be used.
If you want to install typing-extensions@4.14.0, narrow down the `requires-python` range to include this version. For
example, ">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping importlib-resources@6.5.2 because
it requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of importlib-resources
that supports Python>=3.8 will be used.
If you want to install importlib-resources@6.5.2, narrow down the `requires-python` range to include this version. For
example, ">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping importlib-resources@6.5.1 because
it requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of importlib-resources
that supports Python>=3.8 will be used.
If you want to install importlib-resources@6.5.1, narrow down the `requires-python` range to include this version. For
example, ">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping importlib-resources@6.5.0 because
it requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of importlib-resources
that supports Python>=3.8 will be used.
If you want to install importlib-resources@6.5.0, narrow down the `requires-python` range to include this version. For
example, ">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping regex@2026.1.15 because it
requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of regex that supports
Python>=3.8 will be used.
If you want to install regex@2026.1.15, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping regex@2026.1.14 because it
requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of regex that supports
Python>=3.8 will be used.
If you want to install regex@2026.1.14, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping regex@2025.11.3 because it
requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of regex that supports
Python>=3.8 will be used.
If you want to install regex@2025.11.3, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping regex@2025.10.23 because it
requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of regex that supports
Python>=3.8 will be used.
If you want to install regex@2025.10.23, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping regex@2025.10.22 because it
requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of regex that supports
Python>=3.8 will be used.
If you want to install regex@2025.10.22, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping regex@2025.9.18 because it
requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of regex that supports
Python>=3.8 will be used.
If you want to install regex@2025.9.18, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping regex@2025.9.1 because it
requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of regex that supports
Python>=3.8 will be used.
If you want to install regex@2025.9.1, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping regex@2025.8.29 because it
requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of regex that supports
Python>=3.8 will be used.
If you want to install regex@2025.8.29, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping regex@2025.7.34 because it
requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of regex that supports
Python>=3.8 will be used.
If you want to install regex@2025.7.34, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping regex@2025.7.33 because it
requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of regex that supports
Python>=3.8 will be used.
If you want to install regex@2025.7.33, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping regex@2025.7.31 because it
requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of regex that supports
Python>=3.8 will be used.
If you want to install regex@2025.7.31, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
/usr/lib/python3/dist-packages/pdm/resolver/providers.py:191: PackageWarning: Skipping regex@2025.7.29 because it
requires Python>=3.9 but the lock targets to work with Python>=3.8. Instead, another version of regex that supports
Python>=3.8 will be used.
If you want to install regex@2025.7.29, narrow down the `requires-python` range to include this version. For example,
">=3.9" should work.
  return self.repository.find_candidates(
  0:00:25 🔒 Lock failed.  ERROR: Unable to find a resolution because the following dependencies don't work on all Python versions in the range of
the project's `requires-python`: >=3.8.
  python>=3.9 (from <Candidate pictex@2.0.0 from https://pypi.org/simple/pictex/>)
  python>=3.9 (from <Candidate pictex@2.0.1 from https://pypi.org/simple/pictex/>)
A possible solution is to change the value of `requires-python` in pyproject.toml to >=3.9.
  0:00:25 🔒 Lock failed.
See /home/(redacted)/.local/state/pdm/log/pdm-lock-76c5lwha.log for detailed debug log.
[ResolutionImpossible]: Unable to find a resolution
WARNING: Add '-v' to see the detailed traceback

.gitignore is changed slightly to work with PDM. This should work fine with previous versions.

Currently, `<link>` use a workaround to prevent complex process during parsing stage. No CSS3 `@import` support is provided.
I imported `requests` for the implementation of the default fetcher; it's probably unnecessary. If needed, the `request` dependency can be removed, in this case `<link>` support will be disabled.

Signed-off-by: FurryR <awathefox@gmail.com>
Signed-off-by: FurryR <awathefox@gmail.com>
@FurryR

FurryR commented Jan 19, 2026

Copy link
Copy Markdown
Author

If necessary, you can cherry-pick the first commit if you wish to import requests as default fetcher.

Test cases / Changelog / Examples is not ready for the new feature, while author information is also not updated. If necessary you may update them manually.

@francozanardi

Copy link
Copy Markdown
Owner

Hey @FurryR :)

Thanks for opening this PR. I will review it in the next days and let you know.

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