Code Monkey home page Code Monkey logo

sublimeserver's Introduction

SublimeServer

Turn you Sublime Text editor into a HTTP server, and serves all the open project folders, now support ST2 and ST3


Markdown Rendering

When a client requests a Markdown file(.md), the server will return an Html file instead of the requested Markdown file, the Html file contains all of content of the Markdown file and will render Markdown syntax into Html syntax on the client side.

Setup

Open Tools-SublimeServer-Settings, add mime types for Markdown like below

{
	"attempts": 5,
	"autorun": false,
	"interval": 500,
	"mimetypes":
	{
		"": "application/octet-stream",
		".c": "text/plain",
		".h": "text/plain",
		".markdown": "text/x-markdown; charset=UTF-8",
		".md": "text/x-markdown; charset=UTF-8",
		".py": "text/plain"
	},
	"port": 8080
}

Change Log

0.3.3 - Mar 6, 2016

0.3.2 - Oct 12, 2014

  • Add markdown support, thanks rookiecj.
  • Add default stylesheet.
  • Add default extension setting, thanks jdiamond.
  • Fix some ST3 problems

0.3.1 - Jun 1, 2014

Add Sublime Text 3 support.

0.2.1 - Aug 31, 2012

Improvements

  • Add auto-start support, Thanks sapara.(#8)

0.2.0 - Jul 20, 2012

Bug fix:

While dragging new folders to Sublime or remove folders from Sublime, SublimeServer cannot refresh it.(#4) Improvements

  • Custom mime-types support.
  • Disable unavailable menu items, Thanks bizoo.(#6)

0.1.2 - Jun 28, 2012

Bug fix:

  • Thread still alive and cannot stop.(#2)

Misc:

  • Move SublimeServer.sublime-settings to User folder.

0.1.0 - Jun 02, 2012

SublimeServer can basically use

Know issues:

  • While sublime reload plugins, last SublimeServer thread still alive and cannot stop it.(#2)
  • While dragging new folders to Sublime or remove folders from Sublime, SublimeServer cannot refresh it.(#4)

For more details please visit http://learning.github.com/SublimeServer

sublimeserver's People

Contributors

jdiamond avatar learning avatar rookiecj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sublimeserver's Issues

Default serverview address

Everytime i used "View in sublimeServer", it open with "localhost", is there a way to open page in a custom ip address?

file index.md not in subline project folder

Everytime I use "view in SublineServer” , the message will show up.
I don't know how to solve that problem.
Could u give me some advices?
Platform: Windows 10 build 1607
Editor: Subline Text 3 Build 3114, 64 bit

Sublime Server will not display SVG?

Im running windows 8.1, Sublime 2.0.2 Build 2221, just installed Sublime Server through Package Control. For some reason it will not display an SVG I have in an HTML file but it will display a JPG. The SVG comes up when I open the HTML file by double clicking on it in Windows Explorer.

index.php

Will their ever be a work around or fix for other file extensions? Really not trying to switch txt editor's just for this feature.

*.md file not found

When I try open *.md file with server with ST3 on Mac OS X 10.10.1 I'll see next error:

Exception happened during processing of request from ('127.0.0.1', 63877)
Traceback (most recent call last):
  File "./socketserver.py", line 610, in process_request_thread
  File "./socketserver.py", line 345, in finish_request
  File "./socketserver.py", line 666, in __init__
  File "./http/server.py", line 400, in handle
  File "./http/server.py", line 388, in handle_one_request
  File "SublimeServer in /Users/snn/Library/Application Support/Sublime Text 3/Installed Packages/SublimeServer.sublime-package", line 138, in do_GET
  File "SublimeServer in /Users/snn/Library/Application Support/Sublime Text 3/Installed Packages/SublimeServer.sublime-package", line 231, in send_md
  File "./encodings/ascii.py", line 26, in decode
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 3: ordinal not in range(128)

Example of text:

## Информация
- контакты: адрес, телефон, карта проезда, форма обратной связи
- график работы
- врачи: фото, образование, стаж
- отзывы?
- документы: лицензии (где-то были сканы)

resource path case insenstive

I tested with my site and found that the path are case sensitive, which means if my folder is Content and I am looking for content/a.css on the page, the resource is not found.

Would that be an known issue?

Setting to serve files from / instead of /folder

If my folder is named foo and my file is named index.html, I have to browse to localhost:8080/foo/index.html. Could there be a setting that lets me browse to localhost:8080/index.html instead?

Disable unavailable menu items

Hi,

Thanks for this great plugin.

You can disable menu items that refer to a command by implementing a method is_enabled() in the command.
Sorry, I don't have times for a pull request, this is the code to add:

class SublimeserverStartCommand(sublime_plugin.WindowCommand):

    def is_enabled(self):
        global thread
        return not (thread is not None and thread.is_alive())
class SublimeserverStopCommand(sublime_plugin.WindowCommand):
class SublimeserverBrowserCommand(sublime_plugin.TextCommand):

    def is_enabled(self):
        global thread
        return thread is not None and thread.is_alive()

Simulate content negotiation

On my server, I use content negotiation so requests to /foo get resolved to the file named /foo.html on the server. Can SublimeServer be enhanced to assume that a request for files without extensions get the file with a default extension if that file exists? Maybe a default extension setting?

So, if I have this setting set to ".html" and I browser to /folder/foo, and /folder/foo.html exists, it would show the content of /folder/foo.html, but the URL in the browser would still say /folder/foo.

If /folder/foo does exist, it should serve that as normal.

不支持sublime2

!!哇,测试了一晚上,硬是没在sublime2上成功过,因为我sublime2配的已经很好用了,所以没有更新到sb3去,好累啊

关于中文md文件出错的问题

277 html = TEMPLATE % open(path,"r").read()
包含中文的md文件,gb2312编码的可以直接读,但utf-8编码的会出错,多加个异常处理

        except UnicodeDecodeError:
            html = TEMPLATE % open(path,"r",encoding="UTF-8").read()

287 self.send_header("Content-Length", len(html))
len(html)是没转bytes的长度,英文没问题,中文转换后长度就不够了,网页显示不全,改成len(encoded)

Cannot refresh folders

While dragging new folders to Sublime or remove folders from Sublime, SublimeServer cannot refresh it.

Disabled in Sublime 3?

All options (start, Stop, Restart) minus settings are disabled for me in the Sublime 3 alpha.

SublimeServer and index.php

Hello,
It seems that SublimeServer does'nt work with an index.php, it displays only the code and not the page.
Have you an idea.

/markdown.js not found (other "built-ins" like the CSS and Favicon not found either)

I'm using OS X and ST3 build 3124.

When I attempt to read a markdown file, nothing renders. I see that /markdown.js is used to render the file... But it fails as follows in the Sublime Text console.

127.0.0.1 - - [23/Sep/2016 00:15:33] "GET /training-and-such/foundational-javascript-refresher/index.md HTTP/1.1" 200 -
127.0.0.1 - - [23/Sep/2016 00:15:33] code 404, message File not found
127.0.0.1 - - [23/Sep/2016 00:15:33] "GET /markdown.js HTTP/1.1" 404 -

... the same happens for /SublimeServer.css.

127.0.0.1 - - [23/Sep/2016 00:18:03] "GET /training-and-such/foundational-javascript-refresher/ HTTP/1.1" 200 -
127.0.0.1 - - [23/Sep/2016 00:18:03] code 404, message File not found
127.0.0.1 - - [23/Sep/2016 00:18:03] "GET /SublimeServer.css HTTP/1.1" 404 -

I opened up the package file but things are there.

Not sure how Sublime Packages work though. (Did I mention I'm on OS X?)

Project-specific settings

Maybe look in current folder and up the tree until a SublimeServer.sublime-settings file is found? Merge that with the "root" settings file in the User folder?

Very slow performance compared to Apache

Hi,

I've been happily using sublimeserver with ST2 for quite some time, just came across strange issue.

I am running AngularJS app using server plugin.
Looking at Network tab in Chrome DevTools, here's what it says:
SublimeServer - takes 15s to pull in all local resources.
Apache - takes around 1s.

In both cases, cache is cleared, so all resources are fresh (which is irrelevant I guess, since everything is local anyway).

Does anyone know what might be the problem?

loading server

just after starting the server, when i try to view the code on edit pane on the browser, the browser responds with server sent no data

Incorrect Content-Length

> curl -v 127.0.0.1:8080
* Rebuilt URL to: 127.0.0.1:8080/
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.37.1
> Host: 127.0.0.1:8080
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: SublimeServer/0.3.2 Sublime/3065
< Date: Wed, 31 Dec 2014 15:32:24 GMT
< Content-type: text/html; charset=utf-8
< Content-Length: b'<!DOCTYPE html><html>\n<head>\n<meta charset="utf-8"/>\n<title>SublimeServer /</title>\n</head>\n<link rel="stylesheet" type="text/css" href="/SublimeServer.css"><body>\n<h2>SublimeServer /</h2>\n<hr>\n<ul>\n<li><a href="transcoder">transcoder/</a>\n<li><a href="ffmpeg_loft-libdt">ffmpeg_loft-libdt/</a>\n<li><a href="ffmpeg_loft">ffmpeg_loft/</a>\n</ul>\n<hr>\n</body>\n</html>\n'
<

Sublime Text 3, install from Package Control

server dosen't support absolute path?

I am very curious about that why this tool dosen't support absolute path?
Maybe you should not support more than one project , although we may open many projects in ST .

Port setting is ignored

Just installed for the first time. It seems the port setting is ignored by the daemon but not the UI (view on browser context menu). A quick peak at the code shows it's hard coded on the daemon. I have no experience with sublime plugin development so I would prefer not to waste time :P

SublimeServer don't autorun

Summary

SublimeServer don't autorun, when I establish value "autorun": true.

Expected behavior

Run SublimeServer after reboot Sublime Text

Actual behavior

Don't run SublimeServer after reboot Sublime Text. If I press Ctrl+Shift+PSublimeServer: Start SublimeServer the server works.

Steps to reproduce

I checked on plain Sublime Text Portable without plugins. Ctrl+Shift+PSublimeServer: Manage SublimeServer Settings"autorun": true, → reboot Sublime Text 3 → SublimeServer don't autorun.

Environment

  • Operating system and version:
    [√] Windows 10 Education
    • Mac OS ...
    • Linux ...
  • Sublime Text:
    • Build 3114

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.