Sublime & Highlight: pasting as RTF fontsize issue - sublimetext2

I downloaded a package named SublimeHighlight for the Sublime text editor. It serves as my solution to paste syntax highlighted code into Evernote. I have both Evernote and Sublime using the Menlo mono-spaced font. I select text in Sublime, right click and choose "copy as RTF". Pasting into Evernote retains the syntax coloring and indentation. So far so good.
In Evernote I have my default font size set to 14. No matter what my font size is set to in Sublime, when I paste into Evernote the font size is 12. I found this page via google which shed a bit of light on the situation: pygments, used by SublimeHighlight, has a default font size of 12 (do a 'find' on the page for 'fontsize' and you'll see it). The problem is I don't know python (what pygments and SublimeHighlight are written in) and have no idea how to change the font size of pasted-in text from Sublime to Evernote.
All I'm looking for is to past syntax highlighted code from Sublime into Evernote at the correct font size.
EDIT:
I just downloaded Atom and a package for it called Copy as RTF. It works flawless. I really wanted to stay within the Sublime ecosystem, but Atom just works. Plus, Copy as RTF for Atom has more recent updates than SublimeHightlight for Sublime. Whatever works, right?

May be you can try to use UltraEdit, which can help you copy your code as RTF or HTML and paste them into Evernote.
and then
More details can be found here
Or you can try Notepad++ and use the NppExport plugin.
and change the font size you want in Words or Outlook
Check here for more detail
Hope it helps.

Related

How do I copy html, css, Javascript code from email

I am trying to copy code from an email into a a Web page file. I would like the file to have functionality.
I tried copying it directly into a new Sublime file but the colors did not appear as if I had typed it in. When I right clicked background, no open in browser option appeared. I am experimenting with code snippets in blogs and having problems pasting code with functionality in tact. Is this an extension omission ?
Thanks
Sublime will copy plain text, a wysiwyg html editor will copy the markup. If you want to get the markup, do 'show original' (gmail) or whatever your client has as an equivalent. The original will have the markup and can be copied into Sublime. Hope that helps.

Previewing Code in Safari? [Mac Users]

Hi so I recently purchased a mac and I am trying to preview my code in safari and its not working my file is saved as .html and everytime I click the file it just shows me my top sites on safari can someone please help me!
I do not have the reputation to comment yet.
Put the file on your desktop and Get Info. Make sure in the name that the extension is .html and you can also try to check/uncheck Hide Extension and try that as well. Also double check to make sure you do not have any illegal characters in your file name.
Make sure you are not using Word or Pages. Use Text Wrangler or Sublime Text (well really any text editor that allows you to save as specific file types).
I use a Mac for all of my web coding and I have never had this issue.
Edit* If you are using an editor that allows you to choose between rich text and plain text make sure you use plain text. TextEdit is not a plain text editor either.
Load Chrome and then use its view > developer > view source menu option. Works well for me!

How do I program different languages in Sublime Text?

I recently downloaded Sublime Text, but I could only find 9 languages, all of which I don't program. I would like to code HTML, CSS, and JavaScript, and I would like to know how to add these build systems onto my computer.
SublimeText is just a text editor with some 'extra bits' plugged in.
HTML, CSS and JavaScript aren't compiled languages, so you don't need a compiler, just save the file with the correct extention (.html, .cs or .js).
For syntax highlighting, click the box on the far right of the status bar, it'll list some languages that SublimeText knows about, including those three and will helpfully provide syntax colouring and formatting to help you along.
Sublime text is only a text editor. As for HTML, CSS, and JS, those are all present in sublime, and don't require a build system, just a web browser.
If you want to use those languages, use shift-command(control?)-p to open the command pallet and type sshtml, sscss, ssjavascript, etc. to set the syntax highlighting.
To run it, simply open the HTML file in your browser, and reload the page if you've made changes.

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.

text background color in RTF

For some reasons, I need to export RTF data (no images, text-only) from an iOS application to be able to read it in Word or any word processor. For now, this export creates a RTF file that can be read in TextEdit or Word (MacOS & Windows), showing the background color of the original text. Both can read and display correctly the text as it was displayed on the iPhone UIWebView.
But unfortunately, when trying to read this RTF as an input to my iPhone application (and as a quick look provided by iOS in email application), the text color is OK but the background color doesn't display.
When analyzing the HTML created by UIWebView after importing this exported RTF data, I can see that no information about text background color has been kept by iOS's import feature (that is quite logical since the same background color is not displayed by "quick look" feature in iOS email application).
After hours spent to analyze Word RTF version of a document, I couldn't find the good way to code my RTF for background color compatibility. RTF specification speaks about \cbN to put background color to the Nth color of the color table. As Word doesn't implement this \cbN control, I implemented the \chcfpat0\chcbpatN\cbN control to keep compatibility with MacOS TextEdit and Word software (any platform). And it works. But the RTF import tool in iOS neither recognize \chcfpat0\chcbpatN nor \cbN keywords.
Does anybody has any magic idea to deal with that silly problem?
Thanks
I always use WordPad when trying to create simple RTF-formatted documents. Most of the time, I'm trying to display formatted text in a WinForms application, and need something that the RichTextBox control can handle being assigned to its Rtf parameter.
WordPad calls the background color the "text highlight color".
I just used this to display some rich-text in a RichTextBox control with a black background-color. I set the text-highlight-color to black, and the text-color to white, inside WordPad, saved the document, opened the document in Notepad, copied the raw RTF text from there, and assigned it to the Rtf property of a RichTextBox control, and it worked fine.
Hopefully this technique will work in your situation.