Get Sections of a Document to Match HTML Template - javascript

I want let the user import their .docx files and match the sections of .docx file with my HTML page template.
For example;
-Title of imported .docx file should be placed to template's title section,
-Contents of imported .docx file should be placed to template's content section,
-References of imported .docx file should be placed to template's reference section,
-Images of imported .docx file should be placed to template's image section,
and so on.
I have tried mammoth module but It only generates HTML and I cannot find separate sections.
I also think that I can convert the .docx file to .pdf and I used libreoffice-convert module to get .pdf.
Same problem, cannot get sections from the .pdf.
Is there any library in JavaScript or .Net to get sections of .docx or .pdf file?

officegen on npm is good for that :)
Its support docx and pptx :)
Try to check this on npm ^^

Related

How can I disable conversion of .json/.webmanifest url into base64 string?

I have a problem that has been bothering me for a while now. I have a vite-react-typescript project in VSCode, with a link in the index.html page to a webmanifest. This is basically a json file with a different extention.
When I build my app, the index.html output file contains the meta tag, however instead of referencing the path of the .webmanifest file, it has converted the entire file into base64. Because of this some browsers cannot find the .manifest file and therefore the website cannot be installed as a PWA.
I assume the problem/possible solution lies in the compiler/build options of vite, however I don't know how to fix this auto-conversion.
Here is the github repo: https://github.com/PluginDev-A/Website
the compiled index.html file is in the dist directory, the original index.html file is in the main directory. The problem is on line 6 of both files
**It does not matter whether the file-extention is .json or .webmanifest, both urls get converted upon build
That file should be probably placed in public directory because it is:
Never referenced in source code (e.g. robots.txt)
Must retain the exact same file name (without hashing)
And it should be referenced from index.html with absolute path
<link rel="manifest" href="/manifest.webmanifest">

Javascript link to not exist directory

I want to use my javascript file that is in /js directory but I cannot do it.
My file is at htdocs\ElasticSearch\js but the html file points the file to htdocs\ElasticSearch\js\src\main\scripts which doesn't exist
my HTML file here
html code
I want the HTML file to link to htdocs\ElasticSearch\js

How to use babel-plugin to specific file via .babelrc?

I have lot of .js code in my project, but I want to use babel-plugin-add-module-exports to main.js file without affect to all .js files I have.
How can i do that?

include ReadMe.md, convert to markdown and include in html

I am writting a github gh-page index.html:
Is it possible with some javascript, to import the ReadMe.md from a link and send it to the markdown javascript formatter (i think thats the file) of github and append the output somewhere in the index.html?
I am new to javascript and html.

How to move tag script in template to a .js file?

I want to move tag script content in template to a .js file(e.g. in this way, I can use JSHint, whatever) and put it into template directory.
I found the document that said it can treat .js file as a static file, so I must run python manager.py collectstatic every time when I deploy my .js file to server(because I need debug my js code). That is very trivial.
I want to put my .js file and template file which including the .js together, so how to do it?
You can use the --link option in collectstatic to symlink your files rather than copying. That means you only need to run collectstatic again when you are adding a completely new static file, since updates to existing ones will be automatically seen via the symlink.
I add this line in my template file (e.g. template file is path/to/foo.html):
<script>{% include "path/to/send_bill.js" %}</script>
so it include .js file and add into template .html file as origin, but I can modify my .js file separately!
I don't know is there some side effect?
#Daniel Roseman your solution is very graceful.

Categories