Bug 149078 - Support Import Heading > 6 (h7 and greater) From HTML
Summary: Support Import Heading > 6 (h7 and greater) From HTML
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-13 17:54 UTC by wpeaton4
Modified: 2022-05-17 00:54 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wpeaton4 2022-05-13 17:54:36 UTC
Description:
Importing an HTML file (or inserting a text file that is html) will automatically map <h1>-<h6> tags to Heading 1 through Heading 6 styles. <h6> is the maximum heading in the original HTML spec.

It would be really nice if <h7>+ tags could be mapped to Heading 7+ styles.

My particular application arises from generating HTML reports from code that will be used in a nice Writer document. If you have all of the styles set up the way you like them, you can import an HTML file and make very pretty documents.

Steps to Reproduce:
1. Generate HTML file with <h7> tag
2. Make new Writer document
3. Insert...Text from file... select HTML file from step 1

Actual Results:
<h7> tag is stripped and heading is changed to Default style.

Expected Results:
<h7> tag is mapped to Heading 7 style


Reproducible: Always


User Profile Reset: No



Additional Info:
.
Comment 1 wpeaton4 2022-05-13 18:48:27 UTC
A workaround that will get you two extra heading styles is to find another HTML tag that Writer will map to a paragraph style. 

<pre>         maps to Preformatted Text
<blockquote>  maps to Quotations

There are other tags that map to character styles, but those are not helpful. <pre> and <blockquote> can get you up to Heading 7 and Heading 8, but only if you don't use Preformatted Text or Quotations style in your document.

* use <pre> in HTML file for Heading 7
* use <blockquote> in HTML file for Heading 8
* Insert...File from text... select your HTML file
* Do a global search and replace (ctl+H) in your document. Enable Paragraph Styles option. Select Preformatted Text in Find box and Heading 7 in Replace box. Click on Replace All to replace all instances of Preformatted Text paragraph style with Heading 7 style.
* Repeat previous step with Quotations/Heading 8
Comment 2 Julien Nabet 2022-05-14 10:19:58 UTC
According to https://www.w3schools.com/html/html_headings.asp, there's no more than H6.
So H7 and more aren't standard.
IMHO I'd put this one as NOTABUG.
Comment 3 Regina Henschel 2022-05-14 21:26:41 UTC
Yes, a tag <h7> is invalid HTML.
Comment 4 wpeaton4 2022-05-14 23:51:17 UTC
I disagree that this is resolved. It's not a big. It's and enhancement request.
Comment 5 Julien Nabet 2022-05-15 07:02:53 UTC
I don't consider it as an enhancement either since it doesn't respect HTML standard.
=> uncc myself.
Comment 6 wpeaton4 2022-05-17 00:54:21 UTC
Maybe someone can suggest another markdown or markup format besides HTML that Writer supports? 

For me, the whole point of using HTML is to generate professional reports from some kind of relatively simple text file. And inserting an HTML file into a Writer file is like magic: it looks great and the fonts and styles of the parent document are kept. I can process tons of data, make pretty plots in SVG format, insert hundreds of figures into html <img> tags, and import the whole thing into Writer. 

However, one of the biggest drawbacks to this scheme is the limitation on headings. And the workaround I posted is not that great either. If there was any other way of hinting to Writer what style I would like to use, that would be great. I went through every html tag on W3 Schools and only two tags map (pre and blockquote) to Writer paragraph styles.

How would everyone feel about some other mechanism for mapping an html tag to a Writer paragraph style?