Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numbering list not coming properly #394

Open
rajendraprasadyk opened this issue Mar 21, 2024 · 2 comments
Open

Numbering list not coming properly #394

rajendraprasadyk opened this issue Mar 21, 2024 · 2 comments

Comments

@rajendraprasadyk
Copy link

rajendraprasadyk commented Mar 21, 2024

Hi I am trying convert the below mentioned docx file but numbering list is not retaining correctly
cp-test.docx

but i am getting like this
image

HTML response
image

code snippet
let options = {
styleMap: [
"p[style-name='Title'] => h1.act-title:fresh",
"p[style-name='center'] => center",
"p[style-name='Heading 1'] => p:fresh > h1:fresh",
"p[style-name='Heading 2'] => p:fresh > h2:fresh",
"p[style-name='Heading 3'] => p:fresh > h3:fresh",
"p[style-name='Heading 4'] => p:fresh > h4:fresh",
"p[style-name='Heading 5'] => p:fresh > h5:fresh",
"p[style-name='Heading 6'] => p:fresh > h6:fresh",
"p[style-name='Code Block'] => pre:separator('\n')",
"p[style-name='Aside Heading'] => div.aside > h2:fresh",
"p[style-name='Aside Text'] => div.aside > p:fresh",
"u => u",
"p[style-name='Numbering'] => div.aside > h2:fresh",
],
convertImage: mammoth.images.imgElement(function (image) {
return image.read("base64").then(function (imageBuffer) {
return { src: "data:" + image.contentType + ";base64," + imageBuffer };
});
}),
ignoreEmptyParagraphs: false
};

 const result = await mammoth.convertToHtml({ buffer: file.data }, options);
@inimeseke
Copy link

inimeseke commented Apr 12, 2024

I noticed that you did not include the expected output HTML.

I think that this is what we need.

<ol> <li>Text 1</li> </ol> <p>Some text</p> <ol start="2"> <li>Text 2</li> </ol> <p>Some text</p> <ol start="3"> <li>Text 3</li> </ol>

@rajendraprasadyk
Copy link
Author

I noticed that you did not include the expected output HTML.

I think that this is what we need.

<ol> <li>Text 1</li> </ol> <p>Some text</p> <ol start="2"> <li>Text 2</li> </ol> <p>Some text</p> <ol start="3"> <li>Text 3</li> </ol>

yes you are right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants