Repository: ietf-tools/datatracker

Issue:
RFCs without XML are not displayed properly.  RFC6761
### Describe the issue

The `width: 72ch`  of `.rfchtml pre` elements cuts out a few columns of text.  I attach a screenshot of Firefox 102.5.0esr.

Removing the property (using the *explore* feature) renders the text properly.

![screenshot](https://user-images.githubusercontent.com/1738012/207374544-ce9b3cf5-d63e-4ca3-8e40-6b56d870902c.jpg)


### Code of Conduct

- [X] I agree to follow the [IETF's Code of Conduct](https://github.com/ietf-tools/.github/blob/main/CODE_OF_CONDUCT.md)
RFCs without XML are not displayed properly.  RFC6761
### Describe the issue

The `width: 72ch`  of `.rfchtml pre` elements cuts out a few columns of text.  I attach a screenshot of Firefox 102.5.0esr.

Removing the property (using the *explore* feature) renders the text properly.

![screenshot](https://user-images.githubusercontent.com/1738012/207374544-ce9b3cf5-d63e-4ca3-8e40-6b56d870902c.jpg)


### Code of Conduct

- [X] I agree to follow the [IETF's Code of Conduct](https://github.com/ietf-tools/.github/blob/main/CODE_OF_CONDUCT.md)


Discussion:
It looks fine here, FF is my main browser. Are you maybe setting a minimum font size in the FF preferences?
If Lars' hunch is not correct, could you report your OS/version and version of firefox please?
It's very strange.  The screenshot portrayed Firefox 102.5.0esr.  However, I have a copy of Firefox 91.0a1 and it displays the same.  Using the latter, I noticed a horizontal scroll-bar which in the newer version is only visible when hovering on it. 

I created a new profile with Firefox 91.0a1, and it displays the same.

If I enlarge the window, I get a lot of white space, but not the missing columns.  If I restrict the window, after the sidebar disappears the font becomes smaller but the visible text remains the same.

Albeit the Epiphany browser and Lynx don't behave like that, Firefox looks consistent:  if I set width:40ch it truncates as in the following screenshot:
![Screenshot](https://user-images.githubusercontent.com/1738012/207547943-b9648388-af92-4ab8-966b-e3d31e92efd9.png)

FWIW, this is a Linux 5.10 box running Devuan Chimaera.

What happens when you reduce the max font size in the prefs tab?

Also: Are you maybe setting a minimum font size in the FF preferences?
I don't think that's relevant, since I started with a new profile.  The `about:preferences#general` tab has a Fonts and Colors section.  There it says Default font: **Default (Bitstream Vera Serif)** Size: **16**.  In the Advanced dialog it also says Monospace **Default (Bitstream Vera Sans Mono)** Size **12** and Minimum font size **none**.

If I change those settings nothing happens until I uncheck "Allow pages to choose their own fonts, instead of your selections above".  In that case I get the complete text without scrolling.  However, I had never unchecked that box before, and I think no one does.

I'm surprised you cannot reproduce that behavior.  What version of Firefox do you use?
"Allow pages to choose their own fonts, instead of your selections above". is checked for me by default. Weird.

I am currently on 109.0b2.
Over here, with Linux and FF 107.0, I can make this happen to varying degrees by setting a minimum font size in FF's preferences and playing with the htmlizer's "maximum font size" slider.

I *cannot* make it happen at all if FF has minimum font size set to None.

With FF's minimum font size = 10 pts, I *only* see lines truncating for the *smallest* htmlizer maximum font size:
![FF min font size = 10pt, htmlizer max font slider at minimum](https://user-images.githubusercontent.com/19472766/207711453-ca6f1036-5a67-49e9-846e-14930136c229.png)

If I increase FF's minumum font size, say, to 16 pts, I get varying truncation at different htmlizer maximum font sizes. The smaller the htmlizer maximum font size, the fewer characters are displayed. With the slider on full:
![FF min font size = 16pt, htmlizer max font slider at maximum](https://user-images.githubusercontent.com/19472766/207712152-6c51a372-1f2e-4d18-bebb-e3df0056223c.png)
or with it nearer the bottom:
![FF min font size = 16pt, htmlizer max font slider below mid scale](https://user-images.githubusercontent.com/19472766/207712207-b4fe5831-15fc-4d03-9367-37f5977c7c15.png)

The behavior varies if I resize the browser window - in the second screenshot, where FF was set to min font size of 16 pts and the htmlizer has its max font size maximized, the text lines are truncated. If I widen the browser window, more text becomes visible. This happens in discrete steps, not continuously.

Something seems very off with the "maximum font size" slider. I would naively expect that fewer characters would be shown as I allowed larger font sizes but the opposite occurs.
I tried again with FF 110.0a1, with minimum font size **none**.  Same truncation, the text in the first line is truncated at "say that a Domai", which is 60 chars including three spaces on the left.  Since the property is set at 72ch, it seems to be a Mozilla bug, so [I filed it](https://bugzilla.mozilla.org/show_bug.cgi?id=1805865) as such.

I have an "ATI Picasso" card driven by amdgpu at 1680x1050.  Does this affect results?
It looks fine here, FF is my main browser. Are you maybe setting a minimum font size in the FF preferences?
If Lars' hunch is not correct, could you report your OS/version and version of firefox please?
It's very strange.  The screenshot portrayed Firefox 102.5.0esr.  However, I have a copy of Firefox 91.0a1 and it displays the same.  Using the latter, I noticed a horizontal scroll-bar which in the newer version is only visible when hovering on it. 

I created a new profile with Firefox 91.0a1, and it displays the same.

If I enlarge the window, I get a lot of white space, but not the missing columns.  If I restrict the window, after the sidebar disappears the font becomes smaller but the visible text remains the same.

Albeit the Epiphany browser and Lynx don't behave like that, Firefox looks consistent:  if I set width:40ch it truncates as in the following screenshot:
![Screenshot](https://user-images.githubusercontent.com/1738012/207547943-b9648388-af92-4ab8-966b-e3d31e92efd9.png)

FWIW, this is a Linux 5.10 box running Devuan Chimaera.

What happens when you reduce the max font size in the prefs tab?

Also: Are you maybe setting a minimum font size in the FF preferences?
I don't think that's relevant, since I started with a new profile.  The `about:preferences#general` tab has a Fonts and Colors section.  There it says Default font: **Default (Bitstream Vera Serif)** Size: **16**.  In the Advanced dialog it also says Monospace **Default (Bitstream Vera Sans Mono)** Size **12** and Minimum font size **none**.

If I change those settings nothing happens until I uncheck "Allow pages to choose their own fonts, instead of your selections above".  In that case I get the complete text without scrolling.  However, I had never unchecked that box before, and I think no one does.

I'm surprised you cannot reproduce that behavior.  What version of Firefox do you use?
"Allow pages to choose their own fonts, instead of your selections above". is checked for me by default. Weird.

I am currently on 109.0b2.
Over here, with Linux and FF 107.0, I can make this happen to varying degrees by setting a minimum font size in FF's preferences and playing with the htmlizer's "maximum font size" slider.

I *cannot* make it happen at all if FF has minimum font size set to None.

With FF's minimum font size = 10 pts, I *only* see lines truncating for the *smallest* htmlizer maximum font size:
![FF min font size = 10pt, htmlizer max font slider at minimum](https://user-images.githubusercontent.com/19472766/207711453-ca6f1036-5a67-49e9-846e-14930136c229.png)

If I increase FF's minumum font size, say, to 16 pts, I get varying truncation at different htmlizer maximum font sizes. The smaller the htmlizer maximum font size, the fewer characters are displayed. With the slider on full:
![FF min font size = 16pt, htmlizer max font slider at maximum](https://user-images.githubusercontent.com/19472766/207712152-6c51a372-1f2e-4d18-bebb-e3df0056223c.png)
or with it nearer the bottom:
![FF min font size = 16pt, htmlizer max font slider below mid scale](https://user-images.githubusercontent.com/19472766/207712207-b4fe5831-15fc-4d03-9367-37f5977c7c15.png)

The behavior varies if I resize the browser window - in the second screenshot, where FF was set to min font size of 16 pts and the htmlizer has its max font size maximized, the text lines are truncated. If I widen the browser window, more text becomes visible. This happens in discrete steps, not continuously.

Something seems very off with the "maximum font size" slider. I would naively expect that fewer characters would be shown as I allowed larger font sizes but the opposite occurs.
I tried again with FF 110.0a1, with minimum font size **none**.  Same truncation, the text in the first line is truncated at "say that a Domai", which is 60 chars including three spaces on the left.  Since the property is set at 72ch, it seems to be a Mozilla bug, so [I filed it](https://bugzilla.mozilla.org/show_bug.cgi?id=1805865) as such.

I have an "ATI Picasso" card driven by amdgpu at 1680x1050.  Does this affect results?

Resolving patch:
diff --git a/ietf/doc/models.py b/ietf/doc/models.py
--- a/ietf/doc/models.py
+++ b/ietf/doc/models.py
@@ -606,6 +606,7 @@ def htmlized(self):
                 # The path here has to match the urlpattern for htmlized
                 # documents in order to produce correct intra-document links
                 html = rfc2html.markup(text, path=settings.HTMLIZER_URL_PREFIX)
+                html = f'<div class="rfcmarkup">{html}</div>'
                 if html:
                     cache.set(cache_key, html, settings.HTMLIZER_CACHE_TIME)
         return html


Test patch: