I would like to edit file.html with javascript mark ups? Simple open my .html file as .js file.
Go to Tools|Options -> Miscellaneous|Files and for File Extension html change Associated mime type to text/javascript
The answer is yes you probably can, but why would you want to edit an HTML file with Javascript markups/syntax highlighting? Whilst there is nothing preventing you doing it, it is not really good practise to have any significant amount of Javascript in an HTML file, so if you have a large amount it should be in a separate .js file
Related
Is it possible to build a LibreOffice document from code similar to the way a web page is built from HTML and CSS? Can one write an ODF file in which the content and styling are separate, and then/view open in LibreOffice? If so, can one write the code in a text editor as done for HTML/CSS?
There area two reasons I now ask. 1) When I need to make a style change in LibreOffice I have to manually make the same adjustments in a hundred places, such as changing the style of block quotes. 2) I'd like to build documents from a database of text.
I found a question on this in relation to databases but it was about eight years old.
Thank you for any direction you may be able to provide.
Unzip an .odt file that contains styles. You will see two files, content.xml and styles.xml. Edit these files using a text editor and then zip the folder back up to get a modified .odt file.
Be aware that there are two types of styles in the XML files. Named styles are what most people think of as styles, whereas automatic styles are custom formatting, like when you select some text and change the font directly.
The link from tohuwawohu describes utilities to work programmatically with the file. Also as mentioned in the link, it's not too hard to write code yourself. For example in python, import the built-in libraries zipfile and xml.etree.
When working with pthml file, how do I get the HTML-Intellisense like I got when working with html file?
I have the extension PHP Intelephense installed, but it's not recommending the closing tag when adding new HTML tag. Or did I configured something wrongly?
Edited:
VS Code can do this by altering the setting file association. So if I associate the phtml file with html, I get the Intellisense for html, and the same for php. I think what I really want is to associate phtml with html and php... which is impossible for now, I guess.
For reference: https://github.com/Microsoft/vscode/issues/22415
Try:
"files.associations": {
"*.phtml": "html"
}
in your settings file. This should give .phtml files the same intellisense as html files.
Is there any way to configure properly, or turn off all together, the autocomplete/intellisense when coding HTML in a .php or .phtml file? For example, any time I try to close any element it starts suggesting PHP things like $_COOKIE or constantly trying to close a not even open <?php tag.
You can set "php.suggest.basic": false and then install a PHP extension to provide intellisense. I recommend this.
*Disclaimer - I'm the author
I'm working with a file that is one type (php), but the code is predominantly another language (html). Is there a way that I can switch the syntax highlighting (if that's what it's called) from php to html?
associate *.php as PHP files, and DONE
I in a large codebase of an application written in perl there is a lot of HTML and JS written inline in the perl file.
$html_str = qq^ <A LOT OF HTML> ^;
All the code development in done using Eclipse IDE and EPIC plugin. For ease of merging/diffs et al, I am looking for a way to tell the EPIC source formatter not to apply formatting rules to the HTML and JS that is written inline. Is there a way to do this?
HTML embedded in the code is a red flag. That's stuff a designer is going to want to tweak, and so should be able to get at easily. The HTML should be split out into template files. I realize this doesn't answer your question, but it does solve your problem.
Otherwise, use perltidy to handle Perl code formatting. It won't mess with content inside strings and certainly isn't going to try and format HTML.