Closed squidfunk closed 1 year ago
On a more general note, I would recommend not using parsers like BeautifulSoup when building plugins, because they parse the entirety of the content you feed them and construct a tree representation for simple querying. The worst case is that multiple plugins parse the same HTMl over and over again.
In Material for MkDocs, we're always trying to make parsing as efficient as possible:
See our readtime computation implementation with its parser for reference.
Thanks @squidfunk - indeed, I will be looking at removing / simplifying dependencies. There is nothing that simple request could not handle.
We just removed
lxml
from ourrequirements.txt
, because we could refactor all uses to the native HTML parser, which makes download and installation of Material for MkDocs much faster. However, now our builds started failing because this plugin uses BeautifulSoup, which relies on the presence of a parser library.Possible solution: adding lxml to the list of dependencies.