Map to custom CSS?
navarretedaniel opened this issue · comments
I have many custom Word styles that I would like to map to a custom CSS file.
For example:
p[style-name='INDENT_2_TEXT'] =>p.INDENT_2_TEXT
My INDENT_2_TEXT
CSS style is as follows:
p.WD_INDENT_2_TEXT{
margin-top: 0in;
margin-right: 0in;
margin-bottom: 12.0pt;
margin-left: 1.25in;
text-indent: -.5in;
font-size: 11.0pt;
font-family: "Times New Roman", serif;
font-weight: bold;
text-decoration: underline;
}
I'm unclear whether this is possible? If it is, how do I link my CSS stylesheet?
Thank you.
You'll need to include the HTML generated by Mammoth within a document that includes a stylesheet with that class defined.
Appreciate the quick response; I just wasn't sure whether this was an option when using the CLI functionality mammoth document.docx output.html --style-map=custom-style-map
as it automatically creates the HTML document with <html>
, <head>
, and <body>
tags.
Easy enough to do outside the CLI.
Thank you for clarifying.
Mammoth doesn't create the <html>
, <head>
and <body>
tags, just the HTML fragment for the document. If you're opening the fragment in a browser, the browser will automatically add in those elements to the DOM, but they shouldn't be in the actual HTML file.