Comments (7)
Can you give examples of the working HTML via the browser vs. the non-working HTML from vim? Check xclip -selection clipboard -o -t text/html
in both cases.
from vim-syncopate.
Sure. The differences are stark. For one, the (working) HTML via the browser is 10x as big.
Working HTML via the browser:
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<font color="#f0e68c" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<b>function</b>
</font>
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);">! </span>
<font color="#98fb98" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">WifiSsid</font>
<font color="#ffdead" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">()</font>
<br style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);"> </span>
<font color="#f0e68c" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<b>let</b>
</font>
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);"> </span>
<font color="#98fb98" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">l:cmd</font>
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);"> </span>
<font color="#f0e68c" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<b>=</b>
</font>
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);"> </span>
<font color="#ffa0a0" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">"nm-tool |grep --only-matching '*[^ ][^:]*' |sed 's/^*//'"</font>
<br style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);"> </span>
<font color="#f0e68c" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<b>return</b>
</font>
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);"> maktaba#string#</span>
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<font color="#ffffff">Strip</font>
</span>
<font color="#ffdead" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">(</font>
<font color="#98fb98" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">system</font>
<font color="#ffdead" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">(</font>
<span style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none; background-color: rgb(51, 51, 51);">l:cmd</span>
<font color="#ffdead" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">))</font>
<br style="color: rgb(255, 255, 255); font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<font color="#f0e68c" style="font-family: monospace; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(51, 51, 51);">
<b>endfunction</b>
</font>
I had to introduce some manual breaking for readability.
Non-working HTML via clipboard:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/.vimrc_local.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="vim">
<meta name="settings" content="ignore_folding,no_pre,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="desert">
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body bgcolor="#333333" text="#ffffff">
<font face="monospace">
<font color="#f0e68c"><b>function</b></font>! <font color="#98fb98">WifiSsid</font><font color="#ffdead">()</font><br>
<font color="#f0e68c"><b>let</b></font> <font color="#98fb98">l:cmd</font> <font color="#f0e68c"><b>=</b></font> <font color="#ffa0a0">"nm-tool |grep --only-matching '*[^ ][^:]*' |sed 's/^*//'"</font><br>
<font color="#f0e68c"><b>return</b></font> maktaba#string#<span style="background-color: #333333"><font color="#ffffff">Strip</font></span><font color="#ffdead">(</font><font color="#98fb98">system</font><font color="#ffdead">(</font>l:cmd<font color="#ffdead">))</font><br>
<font color="#f0e68c"><b>endfunction</b></font><br>
</font>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
from vim-syncopate.
By the way: if you take the "non-working" HTML, and:
-
Strip everything up to the
<body>
, and after the</body>
(inclusive) -
Surround it in a suitably styled
<div>
, e.g.,<div style='background-color:#333; color: #fff;'>
Then it looks good in the email client.
from vim-syncopate.
Given many quirks and limitations we've discovered in :TOhtml and the fact that what it's doing doesn't seem that hard, I want to at least propose the possibility of bypassing :TOhtml
and just writing our own implementation. It even seems to have a lot of logic devoted to emulating the current vim session (e.g., checking has('gui_running')
), which is the opposite of what we want.
That said, I'm not opposed to taking this paradigm as far as we can and trying to post-process it into something sane.
from vim-syncopate.
I've mulled it over. Rolling our own doesn't sound that crazy. There are certainly a lot of benefits.
However, we have to keep in mind that :TOhtml
does a lot: line numbers and code folding come to mind. Also, I like the "use built-in :TOhtml
options to configure" philosophy; if we roll our own, we either have to jettison that, or else support a lot of obscure features.
I'd definitely consider rolling our own in the future. For now, though, I think we'll get further faster if we just post-process the :TOhtml
output.
from vim-syncopate.
Works beautifully for me.
FWIW, it still doesn't look good in Google Docs (the dark background is shrink-wrapped to only span actual text on the line:
But it does that when I copy from :SyncopateExportToBrowser
and anything else I try, so there may be nothing we can do about that.
from vim-syncopate.
Yeah, I hadn't tested Docs since this last update, but that's what happened for me before.
Oh well -- still a big improvement! I think all these changes are enough to call it 0.2.0 -- about to get a PR ready.
from vim-syncopate.
Related Issues (20)
- Let the user choose their browser HOT 1
- Register syncopate with vim-pi HOT 2
- Document which platforms are supported HOT 1
- Improve error handling for external tools
- Bump version to 0.2.0 HOT 1
- clipboard should be pasteable into non-rich editors
- Document and warn better for missing xclip
- Support OSX HOT 1
- Would like a way to explicitly omit the background color
- Add an operator function
- Support sending output directly to clipboard instead of opening browser HOT 10
- Visual mode export mapping should support exporting partial lines HOT 3
- Export to clipboard shouldn't include trailing newline HOT 1
- Selecting and exporting all lines in the buffer confusingly reports "exported the entire file" HOT 9
- xclip: -t: No such file or directory HOT 11
- Official Google product HOT 3
- Exported syntax highlighted uses unreadable colors HOT 13
- Syncopate resets background to light HOT 10
- Wrong command name in readme HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-syncopate.