Sublime Forum

ExportHtml Plugin (rename from PrintHtml)

#71

I have now added a toolbar with access to print, hide/show gutter, toggle plain text, download theme, and toggle showing annotation table (if exists). You can configure these with the option toolbar when running the command. It just takes an array of the string keywords to tell ExportHTML which (if any) toolbar items you want to show.

I will be removing the text in favor of icons as soon as I get the time to make the icons. After that, I will stop procrastinating the finishing of BracketHighlighter2.

Demo page has been updated with recent changes facelessuser.github.com/ExportHtml/.

0 Likes

#72

@facelessuser

You’re a nutcase (In a good way :smile:)

0 Likes

#73

[quote=“castles_made_of_sand”]@facelessuser

You’re a nutcase (In a good way :smile:)[/quote]

:smile:

On a side note, the toolbar is complete. Demo page is updated.

0 Likes

#74

All changes are in. I fixed some stuff and added the ability to toggle wrapping via the toolbar (if wrapping was enabled). I am done fooling with this for now. Hope you guys like the changes. As always, feel free to report bugs or give feedback. Now I will get back to work on BracketHighlighter2.

Version 0.5.0

  • Added ability to define path to save generated html to a specific folder with optional timestamp
  • If selection foreground is not defined, use normal colors for text.
  • Click annotations to show annotation jump table
  • Removed shortcut actions
  • Themes are now embedded in the html and can be extracted
  • Added toggle plain text option and toggle wrapping (if enababled)
  • Added toolbar to print, download theme, disable toggle wrapping (if enabled), toggle annotation jump table (if annotations available), toggle plain text, and toggle gutter
  • Exposed toolbar options in configuration (can define any toolbar item to appear)
  • Split out javascript into separate files
  • Improved and fixed javascript issues
0 Likes

#75

@facelessuser - just curious what JS issues? I assume nothing too significant…

0 Likes

#76

No nothing noticeable. Mainly sloppy coding on my part. And tried to be more efficient about certain things.

0 Likes

#77

Really wasn’t planning on touching this again so soon, but there where a number of IE bugs (no surprise there), and I really wanted to add support for scopes that use background colors. That’s it for real this time :smile:.

-Fix plain text mode in IE8
-Fix plain text mode copy paste IE(remove syntax highlight so IE copy and paste doesn’t copy hidden elements)
-Fix stippled boxes around toolbar icons when clicked in IE
-Fix sorting of object keys in a way compatible with IE<9
-Fix issues where lines would show gaps between lines in multi-line highlights
-Fix issues in IE when gutter is disabled empty rows collapse
-Move CSS to separate file
-Add global option to configure toolbar orientation (horizontal|vertical)
-Add support for background colors of scopes in theme file

0 Likes

#78

Export Html currently only selects one theme entry to highlight code with, but syntax highlighting themes that heavily use background colors actually have some more dynamic interaction allowing essentially multiple definitions to highlight one bit of text. So one theme entry may paint the background, but another entry will paint the foreground. Themes like this, ExportHtml can render quite ugly. Just an FYI. I might add in a temporary switch to disable background color painting until I get better support in, we shall see. My real goal is to get better background support though. Maybe in a couple of weeks.

0 Likes

#79

I got a little ambitious, and added some better rules for selecting background colors etc. and also actually process transparent colors by simulating what they should look like. I would post an example, but its late.

-Simulate transparency
-More dynamic rules for colors and styles

0 Likes

#80

This is lame dude, I can’t even change theme on the fly :wink:

0 Likes

#81

lol, I know right :smile:.

So here is an example of the new background handeling.

This is ST2

Here is Export HTML (notice I don’t pad the end of the lines yet with color, but generally it looks pretty good…except for the horrible theme :smile:).


Transparency might not be exactly spot on, but it is pretty close. I have to guess how ST2 might be doing it, and then I have a little fudge factor in their to adjust things. In the example above, I believe the reddish and purplish colors use transparency, so they are pretty close.

The padding is trickier than you would think. I am trying to keep the text in tables so I can easily copy and paste any section to an email (which I use a lot). And I am also trying to preserve wrapping for printing. All of these things can be at odds with each other…and exhausting. This is also why, if you use certain fonts, you may see a break between code lines. It is hard for me to get the spans to fill in those lines because they don’t respond to height properites, but I can’t check their pixel height at compile time in python, I would have to do that at run time and then pad every span…ugh. If I remove the table, the problem goes away, but then if I copy and paste a section of the HTML, I lose page background color, and it loses the uniform right edge. If I use block elements and float them left, I lose the easy way to test for line length and wrap them. Web coding can be a real pain.

0 Likes

#82

[quote=“facelessuser”]castles_made_of_sand wrote:
This is lame dude, I can’t even change theme on the fly

lol, I know right .[/quote]

Glad you got the joke :smile:

0 Likes

#83

Okay. Background support is done. I think I may have also solved the gaps between rows with certain fonts on certain platforms.

This is generated by ExportHTML, not ST2 :smile:.


That’s all.

0 Likes

#84

One more thing. The new background coloring feature caused one side affect for people me when copying and pasting code into Outlook.

Apparently, if outlook has html code pasted in it with spans who have a color darker than about 62 luminescence, it renders all the text in those spans as white. Kind of annoying. So I added a feature that the few people who paste dark themes into emails in Outlook might use. The feature causes ExportHTML to scale up the entire theme to ensure that all background colors are at least 62 luminescence (this can be configured to a different value if desired; between 0-255). I also fixed an issue where some themes wouldn’t work because I hadn’t encoded the plist proper that I stuff into the HTML; that is now fixed as well.

Example:
[pre=#2D2D2D] // Minum allowed background lumens a.k.a brightness (0-255)
“bg_min_lumen_threshold”: 62,

    // Browser view color (selections and multi-selections allowed)
    {
        "Browser View - Current Color (EMAIL)": {
            "numbers": true,
            "multi_select": true,
            "shift_brightness": true
        }
    },[/pre]
0 Likes

#85

A fairly useless feature I added for fun. You can use filters in ExportHtml and ExportBbcode. I guess this could be useful if you wanted to apply some filter to theme. Then you could use exportHtml to apply the filter and then extract the theme from the HTML via the download option in the toolbar. Anyways, I realize this feature is pretty worthless, but it was fun nonetheless.

You can use the following: invert, grayscale, sepia, brightness, saturation, hue, colorize.

Unaltered:
[pre=#2D2D2D] // BBCODE menu items
“bbcode_panel”:
{
“To Clipboard - Format as BBCode”: {
“numbers”: false,
“multi_select”: true
}
},[/pre]

Invert:
[pre=#D2D2D2] // BBCODE menu items
“bbcode_panel”:
{
“To Clipboard - Format as BBCode”: {
“numbers”: false,
“multi_select”: true,
“filter”: “invert”
}
},[/pre]

grayscale:
[pre=#2D2D2D] // BBCODE menu items
“bbcode_panel”:
{
“To Clipboard - Format as BBCode”: {
“numbers”: false,
“multi_select”: true,
“filter”: “grayscale”
}
},[/pre]

sepia:
[pre=#3C362A] // BBCODE menu items
“bbcode_panel”:
{
“To Clipboard - Format as BBCode”: {
“numbers”: false,
“multi_select”: true,
“filter”: “sepia”
}
},[/pre]

Saturation:
[pre=#2D2D2D] // BBCODE menu items
“bbcode_panel”:
{
“To Clipboard - Format as BBCode”: {
“numbers”: false,
“multi_select”: true,
“filter”: “saturation(1.5)”
}
},[/pre]

Brightness:
[pre=#606060] // BBCODE menu items
“bbcode_panel”:
{
“To Clipboard - Format as BBCode”: {
“numbers”: false,
“multi_select”: true,
“filter”: “brightness(1.2)”
}
},[/pre]

colorize:
[pre=#2D2D2D] // BBCODE menu items
“bbcode_panel”:
{
“To Clipboard - Format as BBCode”: {
“numbers”: false,
“multi_select”: true,
“filter”: “colorize(0)”
}
},[/pre]

hue (shift):
[pre=#2D2D2D] // BBCODE menu items
“bbcode_panel”:
{
“To Clipboard - Format as BBCode”: {
“numbers”: false,
“multi_select”: true,
“filter”: “hue(60)”
}
},[/pre]

Chain some together:
[pre=#FFFFFF] // BBCODE menu items
“bbcode_panel”:
{
“To Clipboard - Format as BBCode”: {
“numbers”: false,
“multi_select”: true,
“filter”: “hue(60);saturation(1.5);brightness(.8);invert”
}
},[/pre]

0 Likes

#86

I think you just made Instagram for coders.

0 Likes

#87

[quote=“quodlibet”]
I think you just made Instagram for coders.[/quote]

instacode?

I know, I hate myself a little for it :smile:.

0 Likes

#88

1 out of 5 *s

I need blur and vignette to make my code look pretty!1!!1!11!!!

(Also, torn edges would be nice)

0 Likes

#89

[quote=“C0D312”]1 out of 5 *s

I need blur and vignette to make my code look pretty!1!!1!11!!!

(Also, torn edges would be nice)[/quote]

Yes, I think I heard that code runs better if it is prettier.

0 Likes

#90

@facelessuser: you are now inscribed in my signature. classic.

0 Likes