-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
3,583 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,7 @@ zh-cn: | |
disqus_lang: zh | ||
ru: | ||
name: Русский | ||
disqus_lang: ru | ||
disqus_lang: ru | ||
ko: | ||
name: 한국어 | ||
disqus_lang: ko |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
title: Box | ||
--- | ||
Box는 특정 폴더 안의 파일들을 처리하기 위해 사용되는 컨테이너 입니다. Hexo는 `hexo.source`와 `hexo.theme` 두 가지 종류의 Box를 사용합니다: `hexo.source`는 `source` 폴더를 처리할 때 사용되고 `hexo.theme`는 `theme` 폴더를 처리할 때 사용됩니다. | ||
|
||
## 파일 불러오기 | ||
|
||
Box는 `process`와 `watch` 두 가지 종류의 메소드를 지원합니다. `process`는 폴더 안의 모든 파일을 불러옵니다. `watch`도 동일한 동작을 수행하지만 파일이 변경되는 것을 감지(watching)합니다. | ||
|
||
``` js | ||
box.process().then(function(){ | ||
// ... | ||
}); | ||
|
||
box.watch().then(function(){ | ||
// You can call box.unwatch() later to stop watching. | ||
}); | ||
``` | ||
|
||
## 경로 매칭 | ||
|
||
Box는 다양한 방법을 통해 경로를 매칭시킵니다. 당신은 함수 또는 Express-style pattern string을 통해 정규 표현식을 사용할 수 있습니다. 아래는 예시입니다: | ||
|
||
``` plain | ||
posts/:id => posts/89 | ||
posts/*path => posts/2015/title | ||
``` | ||
|
||
[util.Pattern]에서 더 많은 정보를 확인하실 수 있습니다. | ||
|
||
## 프로세서 | ||
|
||
프로세서는 Box의 핵심이 되는 요소이며, 파일을 처리할 때 사용됩니다. 경로 매칭을 사용하여 프로세서가 어떤 프로세스를 처리해야 하는지 제한할 수 있습니다. 새로운 프로세서는 `addProcessor` 메소드를 통해 등록할 수 있습니다. | ||
|
||
``` js | ||
box.addProcessor('posts/:id', function(file){ | ||
// | ||
}); | ||
``` | ||
|
||
Box는 매칭된 파일의 콘텐츠를 프로세서로 넘겨줍니다. 이 정보는 callback의 `file` 인자로부터 직접 읽을 수 있습니다. | ||
|
||
속성 | 설명 | ||
--- | --- | ||
`source` | 파일의 전체 경로 | ||
`path` | 파일의 box에 대한 상대 경로 | ||
`type` | 파일의 형식. `create`, `update`, `skip`, `delete` 네 가지 값을 가질 수 있습니다. | ||
`params` | 경로 매칭으로부터 얻은 정보. | ||
|
||
Box는 개발자의 부담을 덜어주기 위해 file IO에 대한 몇 가지 메소드를 제공합니다. | ||
|
||
메소드 | 설명 | ||
--- | --- | ||
`read` | 파일을 읽습니다 | ||
`readSync` | 파일을 동기적으로 읽습니다 | ||
`stat` | 파일의 상태를 읽습니다 | ||
`statSync` | 파일의 상태를 동기적으로 읽습니다 | ||
`render` | 파일을 생성합니다 | ||
`renderSync` | 파일을 동기적으로 생성합니다 | ||
|
||
[util.Pattern]: https://github.com/hexojs/hexo-util#patternrule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
title: Console | ||
--- | ||
Console은 Hexo와 사용자 간의 교두보 역할을 합니다. 사용 가능한 console 명령어를 등록하고 설명합니다. | ||
|
||
## 개요 | ||
|
||
``` js | ||
hexo.extend.console.register(name, desc, options, function(args){ | ||
// ... | ||
}); | ||
``` | ||
|
||
인자 | 설명 | ||
--- | --- | ||
`name` | 이름 | ||
`desc` | 설명 | ||
`options`| 옵션 | ||
|
||
`args` 인자는 사용자가 터미널에 입력한 값을 포함하여 함수 내로 전달됩니다. [Minimist]에 의해 파싱됩니다. | ||
|
||
## 옵션 | ||
|
||
### 사용법 | ||
|
||
Console 명령어의 사용법의 예시입니다: | ||
|
||
``` js | ||
{usage: '[layout] <title>'} | ||
// hexo new [layout] <title> | ||
``` | ||
|
||
### 인자 | ||
|
||
Console 명령어의 각 인자에 대한 예시입니다: | ||
|
||
``` js | ||
{ | ||
arguments: [ | ||
{name: 'layout', desc: 'Post layout'}, | ||
{name: 'title', desc: 'Post title'} | ||
] | ||
} | ||
``` | ||
|
||
### 옵션 | ||
|
||
Console 명령어의 각 옵션에 대한 예시입니다: | ||
|
||
``` js | ||
{ | ||
options: [ | ||
{name: '-r, --replace', desc: 'Replace existing files'} | ||
] | ||
} | ||
``` | ||
|
||
### 설명 | ||
|
||
Console 명령어에 대한 더 자세한 정보입니다. | ||
|
||
## 예시 | ||
|
||
``` js | ||
hexo.extend.console.register('config', 'Display configuration', function(args){ | ||
console.log(hexo.config); | ||
}); | ||
``` | ||
|
||
[Minimist]: https://github.com/substack/minimist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
title: Deployer | ||
--- | ||
Deployer는 복잡한 명령어를 사용하지 않고도 사용자가 사이트를 원격 서버에 빠르게 deploy할 수 있게 도와줍니다. | ||
|
||
## 개요 | ||
|
||
``` js | ||
hexo.extend.deployer.register(name, function(args){ | ||
// ... | ||
}); | ||
``` | ||
|
||
`args`인자는 사용자가 터미널을 통해 입력한 값은 물론 `_config.yml` 파일 내의 `deploy` 값도 포함하여 함수 내로 전달됩니다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
title: Events | ||
--- | ||
Hexo는 [EventEmitter]를 상속합니다. `on` 메소드를 사용하여 Hexo가 emit한 이벤트를 listen할 수 있습니다. 그리고 `emit`메소드를 사용하여 이벤트를 emit합니다. 더 자세한 정보는 Node.js API 문서를 참고해 주시기 바랍니다. | ||
|
||
### deployBefore | ||
|
||
Deployment가 시작되기 전에 emit합니다. | ||
|
||
### deployAfter | ||
|
||
Deployment가 끝난 후에 emit합니다. | ||
|
||
### exit | ||
|
||
Hexo가 종료되기 전에 emit합니다. | ||
|
||
### generateBefore | ||
|
||
생성(generation)이 시작되기 전에 emit합니다. | ||
|
||
### generateAfter | ||
|
||
생성(generation)이 끝난 후에 emit합니다. | ||
|
||
### new | ||
|
||
새로운 포스트가 생성된 후에 emit합니다. 이 이벤트는 포스트 데이터를 반환합니다: | ||
|
||
``` js | ||
hexo.on('new', function(post){ | ||
// | ||
}); | ||
``` | ||
|
||
데이터 | 설명 | ||
--- | --- | ||
`post.path` | 포스트 파일의 전체경로 | ||
`post.content` | 포스트 파일의 컨텐츠 | ||
|
||
### processBefore | ||
|
||
프로세싱을 시작하기 전에 emit합니다. 이 이벤트는 box의 루트 디렉토리의 경로를 반환합니다. | ||
|
||
### processAfter | ||
|
||
프로세싱이 끝난 후에 emit합니다. 이 이벤트는 box의 루트 디렉토리의 경로를 반환합니다. | ||
|
||
### ready | ||
|
||
초기화 과정이 완료된 후 emit합니다. | ||
|
||
[EventEmitter]: http://nodejs.org/api/events.html |
Oops, something went wrong.