cobrateam / cobrateam/django-htmlmin

need to retain space around inline, inline-block, and comment

Open
#151 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
542
Forks
72
PR merge metrics
No merged PRs in 30d

Description

Currently django-htmlmin retains space around inline text elements. However, there are other inline/inline-block elements that still render whitespace around them that are currently not handled. Also, comment removal takes spaces outside the comment with it.

examples:
```python
>>> from htmlmin.minify import html_minify
>>> html_minify('''example hi''')
'examplehi'
>>> html_minify('''name: ''')
'name:'
>>> html_minify('''

a b

''')
'

ab

'
>>> html_minify('''a b''') # this works as `em` is a text context
'a b'
>>> html_minify(''' click me text after''')
'click metext after'
```

Some of these can be fixed by adding attributes to `TEXT_FLOW`, but they aren't really text elements so naming would probably need adjusting.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the htmlmin.minify.html_minify entry point and inspect the TEXT_FLOW handling mentioned in the issue. Reproduce the supplied examples for img, input, button, and comments, then verify that inline and inline-block whitespace is retained correctly without regressing the existing em behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.