Is there a way to export code to HTML in Eclipse? - html

I know NetBeans has this feature, but I can't find it in Eclipse. A quick search for plugins was not successful.

Java2Html - Eclipse Plugin:
Convert files:
Select items in the Package Explorer, Navigator or other views and right click to open the context menu. There is a Java2Html menu item that opens the conversion dialog.
Convert text from a text editor:
Right click on an editor and choose the Java2Html context menu item to convert the current selected text.
Adjust preferences:
Colors, tab size, etc. for conversion can be adjusted on the preference pages (Menu "Window" - "Preferences" - "Java" - "Java2Html")...

Hackish way:
On Windows at least, when you do Ctrl-A (Select all), Ctrl+C (Copy) what actually gets copied to the clipboard is formatted text (with all the colors and fonts). Then you can paste (Ctrl-V) it to something that can accept formatted text, say Microsoft Word or even Wordpad and save it to whatever format you wish.

The Copy as HTML eclipse IDE plugin allows us to directly copy our
code as HTML and paste it to our blogs or forums without any
formatting.
Download Copy as HTML eclipse plugin
Steps to install the plugin:
Download the Copy as HTML eclipse plugin
Copy it to the 'dropins' folder of your eclipse installation
If 'dropins' folder is not present then copy it to the 'plugins' folder of your eclipse installation
Restart eclipse IDE
That's it
Steps to Use
Select the code or text to be copied
Select 'Copy as HTML' option or press 'cntrl+shift+3'
Paste it your superb blog
Taken from here:
http://java-sample-program.blogspot.hu/2012/12/copy-as-html-eclipse-plugin.html

Related

Eclipse shows no content assist context menu (popup box) for HTML files but works fine for Java files

I use Eclipse 2022-12 with Windows 10 for a Spring Boot project with Maven.
The context menu (the popup box that automatically shows up when you type or press Strg+Space) for autocompletion (java template proposals / content assist) in the editor shows up perfectly fine in Java files (strg + space works too).
I have HTML files that open with the HTML-editor in Eclipse, and the syntax highlighting is fine. But the context menu for code suggestions (auto completion suggestion or html template proposals) simply does not show up, not even with strg+space.
How can I enable the popup for the auto suggestions in HTML files again?
For clarification: It does not show the context menu box at all. Other users had problems where there were no suggestions (template proposals) inside the context menu, but for me the popup does not show up at all for HTML files, but for Java files it works completely fine.
I already tried to change the settings for the html editor under Window > Preferences > Web > HTML Files > Editor > Content Assist. Settings:
"Automatically make suggestions" - activated
"Auto activation delay" - 0
"Prompt when these characters are inserted" - "=<"
The categories for HTML Tag proposals and all the other elements are all activated in booth "Default Proposal Categories" and "Content Assist Pages".
I also de- and reinstalled Eclipse Web Developer Tools and HTML Editor in the Marketplace.
I also opened a new dynamic web project without Maven or Spring Boot, here the HTML editor also does not show the content assist context menu.
I also created a new Workspace, same result.
Edit
I found a workaround...but this does not answer my question, because I think it is not correct that Eclipse does not show me the popup-box inside the HTML-Editor.
Eclipse automaticaly activated the HTML-Editor for HTML-Files, which does not have the popup-box. I activated the Generic Text Editor, which actually shows me the popup-box with HTML-suggestions. I would be happy if someone has a hint why the HTML-Editor is broken in Eclipse 2022-12.
Go to settings
Window
⮑ Preferences
⮑ HTML Files
⮑ Editor
⮑ Content Assist
Then replace <= with;
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._<=

how can i directly open browser to view html file from vs code?

I write HTML and CSS code in VS Code and for previewing it I need to open file explorer then files then double click them to open them in my default browser.
it takes too much time. is there any proper way for this?
I have tried one live extension called live server but the problem with it is we have to click the 'go live' button any time I want to refresh the code.
If the live server extension is the one by Ritwick Dey..
.. then then after clicking Go Live, it will open your page in the default browser and reload it automatically, every time you save your work.
in some cases, it is helpful to save the folder containing your HTML to a Workspace, in VS Code, especially if you are writing an app using the MVC modal and the HTML and CSS are in subfolders.
You can install an extension called open in browser.
After installation complete restart vscode and go to settings Ctrl + ,. Search for Open-in-browser setting and set your default browser as you can see below:
Then whenever you edit a html file, you can use shortcut Alt + B to open this file in browser.

Sublime Text 2 Paste with Colors to MS Word

I would like to paste my code to a word document while preserving the highlighted, colored texts. Is there a way to do this?
You can install highlight plugin and then use SublimeHighlight: copy to clipboard as RTF command from the command palette.
If you want to use your own color scheme use ExportHTML plugin to export to html and copy and paste the html in MS Word.
HTMLExport can be configured to use any of your installed color schemes. just read the docs and look at the default settings.
Use a browser like Safari that can copy in RTF to the clipboard. For me chrome does not work.
My Answer here, is for people who Don't know how to install SublimeHighlight Package on Sublime Text 3:
Install Package Control inside sublime text 3. If you don't know how, follow this link here
Open the Sublime Command Palette by pressing CTRL+SHIFT+P` on Windows or ⌘+⇧+P on Mac
Type "Add Repository", and press enter
Then paste this link https://github.com/n1k0/SublimeHighlight/tree/python3
Press CTRL+SHIFT+P on Windows or ⌘+⇧+P on Mac again and type "Install package" and press enter or return
Type "Sublime highlight" and press enter to install the plugin
Restart your Sublime
How to Use SublimeHighlight
Highlight the Text you want to copy
Press CTRL+SHIFT+P
Type, for example, "SublimeHighlight: copy to clipboard as RTF: " like so:
Paste it in Word or Powerpoint, you will find the text has been pasted with coloring and formatting.
These are the commands you can use:
SublimeHighlight: convert to HTML: will convert current code to highlighted HTML in a new SublimeText tab.
SublimeHighlight: convert to RTF: will convert current code to highlighted RTF in a new SublimeText tab.
SublimeHighlight: view as HTML: will convert current code to highlighted HTML and open it in your default browser.
SublimeHighlight: view as RTF: will convert current code to an RTF document and open the generated file with your default program.
SublimeHighlight: copy to clipboard as HTML: will convert current code to highlighted HTML and store it into the system clipboard.
SublimeHighlight: copy to clipboard as RTF: will convert current code to raw highlighted RTF and store it into the system clipboard.
Customizing the Theme (OPTIONAL):
go to Preferences --> Package Settings --> SublimeHighlight --> Settings-User.
paste this code
{
"theme": "fruity",
"linenos": "inline",
"noclasses": true,
"fontface": "Menlo"
}
Here, I have used the "fruity" theme, you can choose whatever you like. These are all possible themes:
Set Hotkey (OPTIONAL)
In the next code, I have set the CTRL+ALT+C to copy the text with formatting, you can do that following these few steps:
Go to Preferences --> Key Bindings-User.
Paste this code:
{ "keys": ["ctrl+alt+c"],
"command": "sublime_highlight",
"args": { "target": "clipboard",
"output_type": "rtf"
}},
`
Now whenever you copy a text with CTRL+C, it will be copied without formatting and with CTRL+ALT+C, it will be copied with coloring :)
The SublimeHighlight plugin does work well! But as Jorre noted, code can lose some colors. I found that the selection you are copying to the clipboard matters.
When, for example, I select a portion of a CSS stylesheet, but the selection does not include the closing style tag, the colors will be lost. It appears that any incomplete element will be copied to the clipboard as white text.
My solution has been to simply copy the entire code file to the clipboard as RTF, paste into Word, then make the selection there for further copy / pasting into a PowerPoint slide or elsewhere.

Eclipse and .tml files highlighting not working

I'm using eclipse Juno EE IDE for Web Developers.
When I open .tml files, they don't show the correct highlighting and auto complete isn't working. I thought this looked just like it's opening it in a text editor. I right clicked the .tml file and clicked open with > HTML editor and I still don't get the correct highlighting.
This works perfectly on my PC at home, I am at work and it doesn't work properly. Please can someone give me a quick heads up on what setting is wrong? I've spent ages looking and trying different editors, but i'm sure it should just work in the html editor.
Thanks,
Edit: When I hover over the underlined closing html tag, it says "The word is not spelt correctly". It's like it's a text editor, only I did right click > open with html editor.
(If not using Tapestry Tools, as uklance mentioned)
Remember that in addition to editing Eclipse's File Association configuration in:
Window->Preferences->General->Editors->File Associations
you should add the *.tml extension in the Content Types configuration in:
Window->Preferences->General->Content Types
there you should chose html or xml and click add to add *.tml
Have you seen the Tapestry Tools eclipse plugin?
Or you can just add a file association for *.tml to the XML or HTML editors.
Another alternative is using the JSP editor and a custom tld

Sublime text 2: class navigator or browser side bar

Is there a plug-in (or setting) in sublime2 that shows a side pane with a navigator (or tree view) for the class in an active file? Someting similar to the class navigator in netbeans?
Use the CTRL+R command to browser the symbols on the current file, and CTRL+SHIFT+R (only available in Sublime Text 3) to browse symbols in all file opened in tabs.
I think CTags is a nice candidate too.
It uses the ctags executable to index all your project files and allow you to browse through symbols in your whole project. Quite impressive.
Using Sublime2, the CMD+R is the 'Goto Symbol' option on the 'Goto' menu. You may have remapped it. Whilst it isn't a permanent onscreen navigator (like NetBeans for example), it is pretty quick to use.
CMD+R and SHIFT+CMD+R are available on Sublime Text 3 for Mac. CMD+R will browse symbols on the current open file as stated before here, while SHIFT+CMD+R will browse all symbols in all open files if you don't have a ST3 project open, or browse all symbols in all project files if a project is open.
You have to vote here in order to see this functionality implemented in SublimeText :
http://sublimetext.userecho.com/topics/1265-add-a-class-browser/
In the meantime, CTRL+R is the only alternative...