-
Notifications
You must be signed in to change notification settings - Fork 362
Is it possible to support github flavored markdown #27
Comments
Thats indeed a very good idea, i didn't know that GH provide markdown in their API. I think the better would be to create a separate plugin because
So if you're ok with this, i can create that new plugin in the next days |
Thank you for reply.
I think so certainly.
Thank you !! |
Yes, thanks for the great plugin but while looking at a tutorial on md the first thing I looked at was github md and realized I can change these options in markdown pad(for windows) but would much rather do everything from ST2. If it's not too difficult, having a user setting to make the flavor optional would be awesome. |
what do you think ? separate plugin or user settings ? |
User settings would be the way to go. |
I think that separate plugin is good idea. |
Yeah thinking about it, a separate plugin would be great so we can setup key bindings for each depending on which flavor we're using. I was thinking user setting too but that would require editing the user setting every time we want to switch wouldn't it? Thanks |
Any progress on this? |
Yes... the conversion works but i have problems to find a correct CSS. Anyone knows if we can get the github markdown CSS from somewhere ? +@mojombo ? |
You can also try and get in touch with @chenluois, who is the creator of Moo. Moo app has this setting where you can use GitHub flavoured markdown CSS: http://cl.ly/image/1x0a2p3r0G1U and perhaps he can point you in the right direction. |
After a quick google search I found https://gist.github.com/2554919 I haven't looked at what the result of that css actually looks like though. |
Partially fix issue #27: support Github Flavored Markdown
@revolunet have you taken a look at the CSS I posted to see if it is appropriate? |
Ho Hi :) |
Seems there is still a problem. When I try to preview:
With the following settings:
|
thanks can you please open the ST2 console and tell me if this works :
|
Seems to be working for me. |
@tijptjik would be nice if you could open your ST2 console and paste any traceback here |
ah yes! That's more useful.
The plugin updated with Package Control is the latest version with GFM support right? |
@tijptjik ok i initialized the variable but this doesnt help with the github failed conversion. do you have any proxy ? the github APi is accessible via https://api.github.com/markdown |
No proxy, and I can access GitHub API just fine from a REST console. |
hum... can you please comment the try/except clause from line 93 in MarkdownPreview.py to get the full traceback ? |
Traceback (most recent call last):
File "./sublime_plugin.py", line 356, in run_
File "./MarkdownPreview.py", line 95, in run
File ".\urllib2.py", line 126, in urlopen
File ".\urllib2.py", line 391, in open
File ".\urllib2.py", line 414, in _open
File ".\urllib2.py", line 369, in _call_chain
File ".\urllib2.py", line 1194, in unknown_open
urllib2.URLError: <urlopen error unknown url type: https> Could it have to do with the version of Python I'm working with?
|
oops, look like SSL is not supported in Python installation. |
is there a package I could install with pip that would solve this problem? |
@tijptjik can you tell your linux distro plz ? |
Fedora 17
Have kept global as clean as possible from python package, and use virtualenv to install any additional packages. |
heres some pointers : http://www.xinotes.org/notes/note/628/ looks like you need to recompile python with SSL support :/ please keep us informed thanks |
Thanks for your help @revolunet. Any idea why it seems like SublimeText is using a 2.6.6 interpreter when my global python intepreter is version 2.7.3? |
Just because the SSL module is loaded, does not mean the httplib module will use it. Likely the httplib module is being loaded before your package, and at that point the SSL module is not yet loaded. You will probably have to play around with reloading httplib or possibly even urllib and urllib2 after you load ssl. I have not done this because I only use it for FTPS. Another alternative to that is to look at the Package Control source and extract the Curl and Wget downloaders. Most linux installs come with one of those by default. |
just added a force reload on the urllib2 module to test.. @aponxi , tell me if its better please. if not, i'll go the curl way, like in the gist plugin or the package control source. |
@revolunet Unfortunately it didn't work :( Still getting the same error after following the same steps: upgrade, set settings and restart ST2. |
@revolunet Maybe the console output will help (although I'm not sure if its that important to load 0.9.8 since it successfully loads 1.0.0), I just noticed this error: I added for ssl_ver in ['0.9.8', '1.0.0', '10']:
lib_path = os.path.join(arch_lib_path, 'libssl-' + ssl_ver)
print "lib_path: " + lib_path
try:
m_info = imp.find_module('_ssl', [lib_path])
m = imp.load_module('_ssl', *m_info)
print 'Markdown Preview: successfully loaded _ssl module for libssl.so.%s' % ssl_ver
break
except (ImportError) as (e):
print 'Markdown Preview: _ssl module import error - ' + str(e)
if '_ssl' in sys.modules:
plat_lib_path = os.path.join(sublime.packages_path(), 'Markdown Preview', 'lib',
'linux')
try:
m_info = imp.find_module('ssl', [plat_lib_path])
m = imp.load_module('ssl', *m_info)
except (ImportError) as (e):
print 'Markdown Preview: ssl module import error - ' + str(e)
reload(urllib2) The console output is:
This is the folder structure of ssl libraries, it seemed legit to me however I might be missing something:
|
sublime use a python26.zip in itself. curl -kL http://xrl.us/pythonbrewinstall | bash pythonbrew is now installed in $HOME/.pythonbrew [[ -s $HOME/.pythonbrew/etc/bashrc ]] && source $HOME/.pythonbrew/etc/bashrc then use pythonbrew to install python 2.6 pythonbrew install --configure="--enable-unicode=ucs4 --with-zlib --with-ssl --with-threads --enable-share" 2.6 Note that the configure is mine, here just with ' --with-ssl' does matter ln -s $HOME/.pythonbrew/pythons/Python-2.6/lib/python2.6 /Your_Sublime_Install_Path/lib/python2.6 Now sublime text will use python 2.6 lib under pythonbrew with ssl enabled. |
It works!! Thank you @dusteye |
@aponxi glad it did help. In fact there are several sublime plugins can't work on ubuntu due to lack of python lib, pythonbrew is a relatively elegant choice |
@dusteye I have one question, how does sublime know which python to use? I mean why does it choose the symlink we just brewed over the usual python26.zip ? What if I had anotther python lib symlink under sublime/lib, would it try to load both libs? |
@aponxi Actually, the official document does not explain how it does deal with python26.zip and how to search python lib, but in sublime startup information(you cat get it in the console after sublime start) you can see that: Py_GetProgramName(): sublime_text Py_GetExecPrefix(): . Py_GetProgramFullPath(): Py_GetPath(): ./lib/python26.zip:./lib/python2.6/:./lib/python2.6/plat-linux2:./lib/python2.6/lib-tk:./lib/python2.6/lib-old:./lib/python2.6/lib-dynload Py_GetPythonHome(): . I had made several test, no matter /lib/python2.6 exists or not, and no matter other version of python lib such as python2.7 exists, this startup information makes no difference. |
ah gotcha, thanks for the explanation @dusteye 👍 |
thanks @dusteye, you rock 👍 I'll add your protip to the README |
I just tried this on Ubuntu 12.10 and the building Python failed. It appears that others have had the same issue: https://github.com/quarnster/SublimeClang/issues/35 The solution (towards the end off the page) is to run the same command that @dusteye posted, but with 2.6.7 rather than 2.6. Just thought I'd mention it for everyone. Thanks guys! |
@marcantonio Interesting indeed... So you get an error in sublime text? or when brewing python 2.6 ? Could you please specify the error you get for referencing in the future please? Thanks :) |
The error occurs when building python. However, this led to another problem. Apparently, newer versions of Ubuntu don't include support for SSLv2 because of security issues. So when building Python the _ssl module doesn't compile. .. However, pythonbrew includes a patch to address this, but only applies the patch on versions of python <= 2.6.5. This is hardcoded into pythonbrew. 😡 tl;dr: Run:
then:
and everything comes up roses. |
@marcantonio ah I see... I downgraded from 12.10 to 12.04 for things like that... Plus I was getting app crashes too frequently... |
My own solution linux-agnostic, it's based off nginx First of all i created a nginx site, the syntax shown below it's from Ubuntu 12.04 $ sudo gedit /etc/nginx/sites-available/github Content of site server {
listen 80;
server_name github.localhost;
location / {
proxy_set_header Host api.github.com;
proxy_pass https://api.github.com/;
}
access_log /var/log/nginx/github_access.log combined;
error_log /var/log/nginx/github_error.log error;
} add this in 127.0.0.1 github.localhost remember to reboot nginx Install Markdown Preview for Sublime Text 3: $ cd .config/sublime-text-3/Packages/
$ git clone https://github.com/revolunet/sublimetext-markdown-preview.git 'Markdown Preview'
$ cd 'Markdown Preview'
$ git checkout ST3 Edit MarkdownPreview.py --- a/MarkdownPreview.py
+++ b/MarkdownPreview.py
@@ -178,7 +178,7 @@ class MarkdownPreviewCommand(sublime_plugin.TextCommand):
if github_oauth_token:
headers['Authorization'] = "token %s" % github_oauth_token
data = json.dumps(data).encode('utf-8')
- url = "https://api.github.com/markdown"
+ url = "http://github.localhost/markdown"
sublime.status_message(url)
request = urllib.request.Request(url, data=data, headers=headers)
markdown_html = urllib.request.urlopen(request).read().decode('utf-8') And.. HAVE FUN! |
@MrGamer Don't forget to create a symbolic link in /etc/nginx/sites-enabled/ of your file /etc/nginx/sites-available/github to make it work |
@MrGamer Thx a lot. I am a ST3 user too. |
I tried the nginx solution, and works partially.. urls are auto-linked for example, but the auto-linked references like
Doesn't work... it has to do with SSL? |
@MrGamer The best solution. Leave the nginx to resolve HTTPS connections. |
About the @MrGamer solution, if you already have Apache installed you can configure a reverse proxy instead of instaling nginx
|
I wrote this little bit of code to wrap curl. This way you don't have to mess about with a custom python install or proxying through your local web server. It's submitted as a Pull Request. |
I've tried to modified
MarkdownPreview.py
:before
after
I can see html.
But I cannot use normal markdown preview in this case.
I think that I must support css too.
Do you have any plan to support github flavored markdown?
The text was updated successfully, but these errors were encountered: