测试文章

Dillinger

我来看看试试试试所所所

N|Solid

Dillinger is a cloud-enabled, mobile-ready, offline-storage, AngularJS powered HTML5 Markdown editor.

  • Type some Markdown on the left
  • See HTML in the right
  • Magic

New Features!

  • Import a HTML file and watch it magically convert to Markdown
  • Drag and drop images (requires your Dropbox account be linked)

You can also:

  • Import and save files from GitHub, Dropbox, Google Drive and One Drive
  • Drag and drop markdown and HTML files into Dillinger
  • Export documents as Markdown, HTML and PDF

Markdown is a lightweight markup language based on the formatting conventions that people naturally use in email. As John Gruber writes on the Markdown site

The overriding design goal for Markdown’s
formatting syntax is to make it as readable
as possible. The idea is that a
Markdown-formatted document should be
publishable as-is, as plain text, without
looking like it’s been marked up with tags
or formatting instructions.

This text you see here is actually written in Markdown! To get a feel for Markdown’s syntax, type some text into the left window and watch the results in the right.

Tech

Dillinger uses a number of open source projects to work properly:

And of course Dillinger itself is open source with a public repository
on GitHub.

Installation

Dillinger requires Node.js v4+ to run.

Install the dependencies and devDependencies and start the server.

1
2
3
$ cd dillinger
$ npm install -d
$ node app

For production environments…

1
2
3
$ npm install --production
$ npm run predeploy
$ NODE_ENV=production node app

Plugins

Dillinger is currently extended with the following plugins. Instructions on how to use them in your own application are linked below.

PluginREADME
Dropboxplugins/dropbox/README.md
Githubplugins/github/README.md
Google Driveplugins/googledrive/README.md
OneDriveplugins/onedrive/README.md
Mediumplugins/medium/README.md
Google Analyticsplugins/googleanalytics/README.md

Development

Want to contribute? Great!

Dillinger uses Gulp + Webpack for fast developing.
Make a change in your file and instantanously see your updates!

Open your favorite Terminal and run these commands.

First Tab:

1
$ node app

Second Tab:

1
$ gulp watch

(optional) Third:

1
$ karma test

Building for source

For production release:

1
$ gulp build --prod

Generating pre-built zip archives for distribution:

1
$ gulp build dist --prod

Docker

Dillinger is very easy to install and deploy in a Docker container.

By default, the Docker will expose port 80, so change this within the Dockerfile if necessary. When ready, simply use the Dockerfile to build the image.

1
2
cd dillinger
docker build -t joemccann/dillinger:${package.json.version}

This will create the dillinger image and pull in the necessary dependencies. Be sure to swap out ${package.json.version} with the actual version of Dillinger.

Once done, run the Docker image and map the port to whatever you wish on your host. In this example, we simply map port 8000 of the host to port 80 of the Docker (or whatever port was exposed in the Dockerfile):

1
docker run -d -p 8000:8080 --restart="always" <youruser>/dillinger:${package.json.version}

Verify the deployment by navigating to your server address in your preferred browser.

1
127.0.0.1:8000

Kubernetes + Google Cloud

See KUBERNETES.md

Todos

  • Write MOAR Tests
  • Add Night Mode

License

MIT

Free Software, Hell Yeah!

Javascript Array Syntaxlink
1
2
var arr1 = new Array(arrayLength);
var arr2 = new Array(element0, element1, ..., elementN);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include<stdio.h>
#include<string.h>
void getNext(char T[],int next[])//获取next[j]的值
{
int len,j,i;
next[0] = -1;//当j = 0的时候 next[0]为-1
for(j = 1; T[j] != '\0'; j++)//遍历字符串,从第二个字符开始,依次去求next[j]
{
for(len = j - 1; len >= 1; len--)//相等子串的最大长度为j-1,然后依次递减
{
for(i = 0; i <= len-1; i++)
{
if(T[i] != T[j -len+i])//真前缀和真后缀相比,如果不相等就退出for循环,说明不存在长度为len的相等字符串
break;
}
if(len == i)//如果不是中途退出循环的,就说明真前缀和真后缀相等的长度为len,也就是next[j]为len
next[j] = len;
}
if(len < 1)//如果不存在相等子串,也就是属于其他情况
next[j] = 1;
}
}
int KMP(char S[],char T[])
{
int next[80];
int i = 1,j = 1;
getNext(T,next);
while(S[i] != '\0' && T[j] != '\0')
{
if(S[i] == T[j])
{
i++;
j++;
}
else
{
j = next[j];
if(j == -1)//比较第一个字符的时候就不符合情况
{
i++;
j++;
}
}
if(T[j] == '\0')
return (i - strlen(T) + 1);
}
}
int main(void)
{
char S[20] = "ababaababcb", T[10] = "ababc";
printf("%d",KMP(S,T));
return 0;
}
您的支持将鼓励我继续创作!