Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge cli repo for better dependency management #139 #169

Merged
merged 236 commits into from
Mar 18, 2018
Merged
Show file tree
Hide file tree
Changes from 226 commits
Commits
Show all changes
236 commits
Select commit Hold shift + click to select a range
b8a0a54
Create the CLI module.
Gisonrg Jan 9, 2017
c052cc9
Create README.md
Gisonrg Jan 9, 2017
8d011da
Add license.
Gisonrg Jan 9, 2017
66cfe76
Merge branch 'master' of github.com:MarkBind/markbind-cli
Gisonrg Jan 9, 2017
b6196b9
Update README.md
Gisonrg Jan 9, 2017
c8b1c37
Make use of the process's working directory information.
Gisonrg Jan 9, 2017
d696671
1.0.1
Gisonrg Jan 9, 2017
2d8022b
Update markbind module version.
Gisonrg Jan 9, 2017
881a2ae
1.0.2
Gisonrg Jan 9, 2017
62a992b
Update dependency
Gisonrg Jan 12, 2017
c0e3d21
1.0.3
Gisonrg Jan 12, 2017
97505ad
Update dependency
Gisonrg Jan 12, 2017
0563d65
1.0.4
Gisonrg Jan 12, 2017
09a7bcf
Rename example docs folder to “example”
Gisonrg Jan 15, 2017
486822c
Update project package dependencies.
Gisonrg Jan 16, 2017
4f95b83
Add Page and Site models.
Gisonrg Jan 16, 2017
46c8d11
Add markbind generated site template files.
Gisonrg Jan 16, 2017
6fd6d01
Adding “build” and “serve” command. Rewrite using ES6 Promise.
Gisonrg Jan 16, 2017
b9a8f2e
Add repository info to the package.json.
Gisonrg Jan 16, 2017
30aa1d0
1.1.0
Gisonrg Jan 16, 2017
7765113
Improve the site reload logic.
Gisonrg Jan 17, 2017
07cf266
1.1.1
Gisonrg Jan 17, 2017
f147b50
Code refactoring and formatting.
Gisonrg Jan 17, 2017
966bbd4
Implement “init” command.
Gisonrg Jan 17, 2017
8e007c6
1.1.2
Gisonrg Jan 17, 2017
99b8800
Add logger module for printing message to console
Gisonrg Jan 18, 2017
a163e26
Improve the CLI commands and their options.
Gisonrg Jan 18, 2017
44ffda6
Update the README.md
Gisonrg Jan 18, 2017
c9481a2
Update README.md
Gisonrg Jan 18, 2017
8a975cb
1.1.3
Gisonrg Jan 19, 2017
a297596
Update the site.json config. Update the assets location.
Gisonrg Jan 23, 2017
933e67e
Fix a bug that site.json is not correctly written.
Gisonrg Jan 23, 2017
a442572
Update vue-strap.js.
Gisonrg Jan 23, 2017
759ccf6
Update markbind version.
Gisonrg Jan 23, 2017
49f2cdc
1.1.4
Gisonrg Jan 23, 2017
f5f7ba2
Add new dynamic loading components.
Gisonrg Feb 5, 2017
982f6d2
Update vue-strap.
Gisonrg Feb 6, 2017
014b7b3
Add utility class for fs helper functions
Gisonrg Feb 6, 2017
41bcf92
Handle dynamic resources when generating the site.
Gisonrg Feb 6, 2017
94c3269
Update markbind core version
Gisonrg Feb 6, 2017
0918b7d
1.1.5
Gisonrg Feb 6, 2017
281e6ae
Update vue-strap used.
Gisonrg Feb 9, 2017
cd9010f
Code refactoring
Gisonrg Feb 9, 2017
49cb8ba
Update page template to include navbar component
Gisonrg Feb 9, 2017
9117f68
Update page template.
Gisonrg Feb 23, 2017
3b11a8e
Remove temp folder after generation.
Gisonrg Feb 23, 2017
a196e4b
Update assets.
Gisonrg Feb 27, 2017
3caaa04
Update vuestrap library.
Gisonrg Mar 5, 2017
be149ad
Update template and vue-strap.
Gisonrg Mar 6, 2017
48dd99d
Update template page.
Gisonrg Mar 15, 2017
ad3ddc9
Add support for baseUrl when serving the site.
Gisonrg Mar 16, 2017
2288d16
Update project dependency
Gisonrg Mar 17, 2017
9570a0a
1.2.0
Gisonrg Mar 17, 2017
c47344b
Update vuestrap.
Gisonrg Mar 19, 2017
484da05
1.2.1
Gisonrg Mar 19, 2017
eaa2df6
Read base url from ‘site.json’ instead of from command line option.
Gisonrg Mar 19, 2017
d535ce5
Refine the page generation logic.
Gisonrg Mar 19, 2017
54d7c02
Handle MarkBind-core error.
Gisonrg Mar 19, 2017
a4c4c02
Update markbind-core version.
Gisonrg Mar 19, 2017
ab05246
1.2.2
Gisonrg Mar 19, 2017
cbb9edc
Fix an error that no config is read.
Gisonrg Mar 19, 2017
96fb95e
1.2.3
Gisonrg Mar 19, 2017
2e9eb61
Implement the github pages deployment service.
Gisonrg Mar 20, 2017
3440988
Don’t overwrite existing site.json and index when call “markbind init”
Gisonrg Mar 20, 2017
75bd558
Update readme and clean up
Gisonrg Mar 20, 2017
e869f9d
1.2.4
Gisonrg Mar 20, 2017
49a98bc
Fix a base url bug
Gisonrg Mar 22, 2017
8d5ae03
Update the template and Vue library.
Gisonrg Mar 22, 2017
8ca4ffd
Use new core library version
Gisonrg Mar 23, 2017
f97545a
Create separate script for view setup
Gisonrg Mar 23, 2017
e673164
1.2.5
Gisonrg Mar 23, 2017
80d0b71
Update core library version
Gisonrg Mar 24, 2017
4c7bfaf
Update for syntax highlighting.
Gisonrg Mar 24, 2017
4b2c577
1.2.6
Gisonrg Mar 24, 2017
ec2c2e7
Update Yarn.lock
Gisonrg Mar 24, 2017
6f310f8
Update package dependency
Gisonrg Mar 26, 2017
a2fbff7
1.2.7
Gisonrg Mar 26, 2017
3109172
Update VueStrap library
Gisonrg Mar 29, 2017
2aa95c9
1.2.8
Gisonrg Mar 29, 2017
acc19e6
Update VueStrap library
Gisonrg Mar 30, 2017
926c539
1.2.9
Gisonrg Mar 30, 2017
2c3341c
Update Html beautify.
Gisonrg Apr 10, 2017
017a0e0
Update vuestrap library
Gisonrg Apr 10, 2017
f3eb295
1.2.10
Gisonrg Apr 10, 2017
271858e
Update vuestrap
Gisonrg Apr 14, 2017
7789514
Fix the issue that live upload does not update dynamically included c…
Gisonrg Apr 27, 2017
498069c
Handle baseUrl rendering in dynamic loaded content correctly.
Gisonrg Apr 28, 2017
b812ebb
Update vue-strap library.
Gisonrg Apr 28, 2017
5ddd886
Update vue-strap version.
Gisonrg Apr 29, 2017
f09c0f9
Update core library version.
Gisonrg Apr 29, 2017
56e6f69
Update Yarn lock.
Gisonrg Apr 29, 2017
f937a93
1.2.11
Gisonrg Apr 29, 2017
2f86670
1.2.12
Gisonrg Apr 29, 2017
21f367d
Update vue-strap version.
Gisonrg May 9, 2017
3f8681a
Update library dependencies.
Gisonrg May 16, 2017
d981cdb
Support include pages from a child markdown site project without chan…
Gisonrg May 16, 2017
a1a4540
1.3.0-0
Gisonrg May 16, 2017
da6d299
Update vue-strp library.
Gisonrg May 19, 2017
32bff88
1.3.0
Gisonrg May 19, 2017
32fa0a7
Store dynamic include file in original directory
acjh Jul 2, 2017
e798313
Merge branch 'acjh-70-dynamic-panels'
Gisonrg Jul 4, 2017
69515ef
Update core library version
Gisonrg Jul 4, 2017
6ba821f
1.3.1
Gisonrg Jul 4, 2017
5bc1dbe
Update library version.
Gisonrg Jul 9, 2017
2496954
Update core library version.
Gisonrg Jul 9, 2017
4ed57da
1.3.2
Gisonrg Jul 9, 2017
5d66b37
Update for changes in dependency data handling.
Gisonrg Jul 15, 2017
5ca989f
Re-order the page generation process to fix the code block display er…
Gisonrg Jul 15, 2017
ce16c2a
Update VueStrap library version.
Gisonrg Jul 15, 2017
a213da9
Update core library version
Gisonrg Jul 15, 2017
a96c361
1.3.3
Gisonrg Jul 15, 2017
939025b
Use smaller font size for blockquotes
acjh Jul 21, 2017
ca7adce
Support generated baseUrl relative to host project
acjh Jul 23, 2017
a1576c2
Update VueStrap library version
acjh Jul 27, 2017
dcf0730
Hide Answer if it is not provided in Question
acjh Jul 27, 2017
278561c
Merge pull request #5 from acjh/79-dynamic-panel-in-submodule
Gisonrg Jul 28, 2017
8e342d7
Merge pull request #4 from acjh/51-smaller-font-size-for-blockquotes
Gisonrg Jul 28, 2017
9e2bf80
Merge pull request #6 from acjh/77-omit-answer-if-not-provided
Gisonrg Jul 28, 2017
c6ccc32
Add new NPM package-lock files.
Gisonrg Jul 28, 2017
c396c10
1.3.4
Gisonrg Jul 28, 2017
00853b0
Resolve baseUrl for submodule
acjh Jul 28, 2017
fd37f9c
Use ternary operator for baseUrl
acjh Jul 28, 2017
d1fd022
Merge pull request #7 from acjh/79-dynamic-panel-in-submodule-fix
Gisonrg Jul 29, 2017
839d352
Merge branch 'master' of https://github.com/MarkBind/markbind-cli
Gisonrg Jul 29, 2017
32c23b9
1.3.5
Gisonrg Jul 29, 2017
b25ee12
TipBox: Use flag emoji for 'important'
acjh Aug 3, 2017
3d6c6ca
Fix hostBaseUrl not passed in as context parameter
acjh Aug 7, 2017
3c629a2
Merge branch '93-nested-dynamic-includes' of git://github.com/acjh/ma…
Gisonrg Aug 9, 2017
031d92e
Merge pull request #8 from acjh/89-tipbox-use-flag-emoji
Gisonrg Aug 9, 2017
8400345
Merge branch 'acjh-93-nested-dynamic-includes'
Gisonrg Aug 9, 2017
90d0fba
Merge branch 'master' of https://github.com/MarkBind/markbind-cli
Gisonrg Aug 9, 2017
b5f7de7
1.3.6
Gisonrg Aug 9, 2017
85d6256
Use baseUrl to included file instead of sourcePath
acjh Aug 29, 2017
7813f89
Merge branch 'acjh-98-rebase-links-in-nested-panel'
Gisonrg Aug 29, 2017
adb8160
Update dependency related files.
Gisonrg Aug 29, 2017
cdd41f4
Panel: Add 'collapse' button at bottom
acjh Oct 10, 2017
b735a82
1.3.7
acjh Oct 10, 2017
2ef57c3
Merge pull request #11 from acjh/23-panel-add-collapse-at-bottom
acjh Oct 10, 2017
fb98c94
1.4.0
acjh Oct 10, 2017
cf86512
Panel: Improve styling of bottom 'collapse' button
acjh Oct 10, 2017
ca402eb
Merge branch '23-panel-add-collapse-at-bottom'
acjh Oct 10, 2017
fd1013b
1.4.1
acjh Oct 10, 2017
d0b0bbc
Panel: Enable 'bottom-switch' by default
acjh Oct 15, 2017
0498711
Merge branch '23-panel-add-collapse-at-bottom'
acjh Oct 15, 2017
3974363
1.4.2
acjh Oct 15, 2017
7a98a2f
Inherit font weight for radio-list-item label
nicholaschuayunzhi Jan 16, 2018
c5c808c
Merge pull request #12 from nicholaschuayunzhi/95-inherit-font-weight…
acjh Jan 16, 2018
885affe
update package lock
Gisonrg Jan 17, 2018
c1b7a48
Pass config to rebase reference for static includes
acjh Jan 17, 2018
790d3b3
Remove deprecated callback parameter
acjh Jan 19, 2018
0425ff9
Fix readability of dropdown on mobile
danielbrzn Jan 16, 2018
16c1b61
Fix navbar dropdown access on mobile
danielbrzn Jan 16, 2018
a94160d
Merge pull request #15 from acjh/94-rebase-ref-for-static-includes
Gisonrg Jan 19, 2018
de80cff
Merge branch 'master' of github.com:MarkBind/markbind-cli
Gisonrg Jan 19, 2018
dd8b255
Update markbind core version for an API change.
Gisonrg Jan 19, 2018
2614f70
Merge pull request #13 from danielbrzn/navbar-fix
Gisonrg Jan 20, 2018
aad5c7f
Add eslint file
nicholaschuayunzhi Jan 16, 2018
1bf1ebb
Add eslintignore for minified
nicholaschuayunzhi Jan 16, 2018
ed21d5f
Merge pull request #14 from nicholaschuayunzhi/eslint
acjh Jan 21, 2018
c7809f9
Apply eslint --fix
nicholaschuayunzhi Jan 22, 2018
969c071
Fix some style errors manually
nicholaschuayunzhi Jan 22, 2018
46a2293
Fix ESLint errors
acjh Jan 22, 2018
82a40ea
Replace 'site.json' with SITE_CONFIG_NAME
acjh Jan 22, 2018
5469781
Merge pull request #16 from nicholaschuayunzhi/eslint-fix
acjh Jan 23, 2018
664f863
Update vue strap file to show popovers for mobile safari
rachx Jan 27, 2018
1f21a39
Merge pull request #18 from rachx/mobile-safari-vuestrap
Gisonrg Jan 28, 2018
6992dec
Update default site config baseUrl to ''
nicholaschuayunzhi Jan 28, 2018
25b595d
Merge pull request #19 from nicholaschuayunzhi/124-site-config
acjh Jan 29, 2018
4e76f70
Rebuild included html per generate
nicholaschuayunzhi Jan 31, 2018
2accb6e
Update js doc for resolve dependency
nicholaschuayunzhi Feb 2, 2018
f2ddd84
Merge pull request #21 from nicholaschuayunzhi/127-nested-reload
acjh Feb 3, 2018
bab9b7a
Update markbind version to v1.1.7
acjh Feb 4, 2018
61b0950
1.4.3
acjh Feb 4, 2018
1ff54e8
Remove clean up dependency
nicholaschuayunzhi Feb 4, 2018
e8e8eea
Merge pull request #22 from nicholaschuayunzhi/88-remove-cleanup
acjh Feb 7, 2018
1522701
Add '*md' to default site config ignore
nicholaschuayunzhi Feb 9, 2018
f77e504
Update markbind version to v1.2.0
acjh Feb 10, 2018
41095c9
Pass rootPath and baseUrlMap in all includeFile and renderFile calls
rachx Feb 8, 2018
282dff8
Create _boilerplates folder in init site
rachx Feb 10, 2018
e8e5779
Ignore json files
nicholaschuayunzhi Feb 10, 2018
7c40be8
Merge pull request #25 from rachx/new-boilerplate
acjh Feb 14, 2018
feee241
Update markbind version to v1.2.1
acjh Feb 14, 2018
ce67b79
Add functionality to rebuild only changed pages
nicholaschuayunzhi Feb 3, 2018
09ce573
Add add handler and update remove handler
nicholaschuayunzhi Feb 3, 2018
5dbef46
Add jsdoc for buildSourceFiles and generatePages
nicholaschuayunzhi Feb 5, 2018
6dac43c
Extract isSourceFile
nicholaschuayunzhi Feb 7, 2018
6b04530
Account for boilerplate files
nicholaschuayunzhi Feb 10, 2018
3a36273
Add basic test site
Feb 14, 2018
a6af738
Add include from other Markbind site
danielbrzn Feb 14, 2018
956da62
Merge pull request #17 from nicholaschuayunzhi/88-speedup-live-reload
acjh Feb 15, 2018
8a0871d
Merge pull request #26 from nicholaschuayunzhi/46-ignore-md
acjh Feb 15, 2018
e1e47cf
1.5.0
acjh Feb 15, 2018
8f67540
Update to include open bugs section
danielbrzn Feb 19, 2018
d6d1cbb
Update gh-pages to v1.1.0
nicholaschuayunzhi Feb 23, 2018
8f0d379
Add rule to ignore md files for site build
danielbrzn Feb 24, 2018
d8485ae
Set NODE_DEBUG=gh-pages when deploying
nicholaschuayunzhi Mar 3, 2018
b5a9e7d
Update setup.js to allow for search functionality using site.json
danielbrzn Feb 25, 2018
efe3269
Add style overrides for search readability on mobile
danielbrzn Feb 25, 2018
dd2f060
Merge pull request #30 from nicholaschuayunzhi/141-update-gh-pages
Gisonrg Mar 10, 2018
72bcc58
Move test_site to a test folder to allow consolidation of future tests
danielbrzn Mar 10, 2018
788c39b
collect user defined variables map
rachx Mar 8, 2018
4d96fbd
Create variables.md in initSite
rachx Mar 10, 2018
05b5efa
add vertical lines to tables
nicholaschuayunzhi Mar 3, 2018
5a3cf65
Merge pull request #27 from danielbrzn/add-test-site
acjh Mar 11, 2018
92fd829
Merge pull request #32 from danielbrzn/add-search
acjh Mar 11, 2018
d94b027
Update vue-strap version to v1.1.37-markbind.2
acjh Mar 11, 2018
1e8ff03
Update markbind version to v1.3.0
acjh Mar 11, 2018
8c0a84e
Merge pull request #33 from nicholaschuayunzhi/149-format-vertical-table
acjh Mar 11, 2018
0fb6df4
Merge pull request #34 from rachx/support-variables
acjh Mar 11, 2018
d88201b
remove bullet for task and radio list items
nicholaschuayunzhi Mar 10, 2018
23041d6
Add missingIncludeSrc in included files
rachx Mar 11, 2018
4ed5808
Ignore intellij temp files
rachx Mar 11, 2018
a14887c
Merge pull request #35 from nicholaschuayunzhi/158-remove-bullet-task…
acjh Mar 11, 2018
d3eda69
1.6.0
acjh Mar 11, 2018
09aab07
Add travis and test scripts for site compare
nicholaschuayunzhi Mar 11, 2018
ee7653d
Add expected site
nicholaschuayunzhi Mar 11, 2018
e37aba3
Use custom delay function to delay rebuildSourceFiles etc. for wait m…
rachx Mar 11, 2018
84c3238
add comment to test.sh
nicholaschuayunzhi Mar 14, 2018
5e7d3ac
update diff into a dev dependency
nicholaschuayunzhi Mar 14, 2018
8bf51b9
update test to compare html files only
nicholaschuayunzhi Mar 14, 2018
9957c5e
fix grammar in jsdoc in diffHtml
nicholaschuayunzhi Mar 14, 2018
e733b51
Add execute permission to test script by default
Gisonrg Mar 17, 2018
db84b63
Merge branch 'nicholaschuayunzhi-121-travis-setup'
Gisonrg Mar 17, 2018
729a827
Add Travis Badge to README.md
Gisonrg Mar 17, 2018
5f10462
Extract delay into utils
rachx Mar 17, 2018
df3a62b
Move core library into lib/markbind
acjh Mar 17, 2018
7402e2a
Update eslintignore for lib/markdown-it/*
acjh Mar 17, 2018
374e3e9
Add htmlparser2 as a dependency
danielbrzn Mar 17, 2018
59830af
Merge branch 'cli'
acjh Mar 17, 2018
83b373c
Restore eslint-plugin-lodash
acjh Mar 17, 2018
c36f595
Use local markbind
acjh Mar 17, 2018
d0ffdcb
Bump markbind version to v1.6.0 to sync with cli
acjh Mar 18, 2018
d5f851f
Update url of markbind-cli to point to merged repo
acjh Mar 18, 2018
5d01c70
Merge pull request #38 from danielbrzn/add-htmlparser2-dep
danielbrzn Mar 18, 2018
737b146
Merge pull request #31 from rachx/live-reload
rachx Mar 18, 2018
73f1263
Merge branch 'cli'
acjh Mar 18, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*.min.*
lib/markdown-it/*
*.min.*
lib/markbind/lib/markdown-it/*
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ jspm_packages
# Optional REPL history
.node_repl_history

docs/_site/*
docs/_site/*

# Generated site (MarkBind)
test/test_site/_site
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: node_js
node_js:
- '8'
before_install:
- chmod +x ./test/test_site/test.sh
cache:
directories:
- node_modules
sudo: false
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
# MarkBind

To go to the MarkBind website, click [here](https://markbind.github.io/markbind/).
To go to the MarkBind website, click [here](https://markbind.github.io/markbind/).

```
__ __ _ ____ _ _
| \/ | __ _ _ __ | | __ | __ ) (_) _ __ __| |
| |\/| | / _` | | '__| | |/ / | _ \ | | | '_ \ / _` |
| | | | | (_| | | | | < | |_) | | | | | | | | (_| |
|_| |_| \__,_| |_| |_|\_\ |____/ |_| |_| |_| \__,_|
```

Command line interface for MarkBind

[![Build Status](https://travis-ci.org/MarkBind/markbind-cli.svg?branch=master)](https://travis-ci.org/MarkBind/markbind-cli)

## How to install it?
```
npm i -g markbind-cli
```

## Usage
```
Usage: markbind <command>


Commands:

include [options] <file> process all the fragment include in the given file
render [options] <file> render the given file
init [root] init a markbind website project
serve [options] [root] build then serve a website from a directory
build [root] [output] build a website
deploy deploy to Github Pages

Options:

-h, --help output usage information
-V, --version output the version number
```

## Documentation
Refer to the [Wiki](https://github.com/MarkBind/markbind-cli/wiki) page.
You may want to learn about how to [create and build a site with MarkBind](https://github.com/MarkBind/markbind-cli/wiki/Develop-a-site-with-MarkBind)
6 changes: 6 additions & 0 deletions asset/css/bootstrap.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions asset/css/github.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions asset/css/markbind.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
blockquote {
font-size: 14px;
}

.markbind-table {
width: auto;
}

.radio-list-item,
.task-list-item {
list-style-type: none;
margin: 0 0 0 -1.2em;
}

.radio-list-item label {
font-weight: inherit;
}

.table-striped > thead,
.table-striped > tbody > tr:nth-of-type(even) {
background-color: #fff;
}

@media (max-width: 767px) {
.dropdown-menu > li > a {
white-space: normal;
}

.navbar-default .navbar-nav .open .dropdown-menu > li > a,
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a {
color: #333;
}

.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
.navbar-inverse .navbar-nav .open .dropdown-menu > .active > a {
background-color: #337ab7;
}

.navbar-nav .open .dropdown-menu {
background-color: #fff;
}
}
Binary file added asset/fonts/glyphicons-halflings-regular.eot
Binary file not shown.
288 changes: 288 additions & 0 deletions asset/fonts/glyphicons-halflings-regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added asset/fonts/glyphicons-halflings-regular.ttf
Binary file not shown.
Binary file added asset/fonts/glyphicons-halflings-regular.woff
Binary file not shown.
Binary file added asset/fonts/glyphicons-halflings-regular.woff2
Binary file not shown.
39 changes: 39 additions & 0 deletions asset/js/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* eslint-disable no-undef */

Vue.use(VueStrap);

function setup() {
const vm = new Vue({
el: '#app',
});
VueStrap.installEvents(vm);
}

function setupWithSearch(siteData) {
const routeArray = jQuery.map(siteData.pages, object => object.src);
const titleArray = jQuery.map(siteData.pages, object => object.title);
const { typeahead } = VueStrap.components;
const vm = new Vue({
el: '#app',
components: {
typeahead,
},
data() {
return {
searchData: titleArray,
};
},
methods: {
searchCallback(match) {
const index = titleArray.indexOf(match);
const route = routeArray[index];
window.location.pathname = route.replace('.md', '.html');
},
},
});
VueStrap.installEvents(vm);
}

jQuery.getJSON('../../site.json')
.then(siteData => setupWithSearch(siteData))
.catch(() => setup());
39 changes: 39 additions & 0 deletions asset/js/vue-strap.min.js

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions asset/js/vue.min.js

Large diffs are not rendered by default.

232 changes: 232 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
#!/usr/bin/env node


// Entry file for Markbind project
const clear = require('clear');
const fs = require('fs-extra-promise');
const path = require('path');
const Promise = require('bluebird');
const program = require('commander');
const htmlBeautify = require('js-beautify').html;
const liveServer = require('live-server');
const chokidar = require('chokidar');

const logger = require('./lib/util/logger');
const fsUtil = require('./lib/util/fsUtil');
const Site = require('./lib/Site');
const MarkBind = require('markbind');

const CLI_VERSION = require('./package.json').version;

const ACCEPTED_COMMANDS = ['version', 'include', 'render', 'init', 'build', 'serve', 'deploy'];

const markbinder = new MarkBind();

clear();

process.title = 'MarkBind';
process.stdout.write(
`${String.fromCharCode(27)}]0; MarkBind${String.fromCharCode(7)}`,
);

program
.allowUnknownOption()
.usage(' <command>');

program
.version(CLI_VERSION);

program
.command('include <file>')
.description('process all the fragment include in the given file')
.option('-o, --output <path>', 'output file path')
.action((file, options) => {
markbinder.includeFile(path.resolve(process.cwd(), file))
.then((result) => {
if (options.output) {
const outputPath = path.resolve(process.cwd(), options.output);
fs.outputFileSync(outputPath, result);
logger.logo();
logger.info(`Result was written to ${outputPath}`);
} else {
logger.log(result);
}
})
.catch((error) => {
logger.logo();
logger.error('Error processing fragment include:');
logger.error(error.message);
});
});

program
.command('render <file>')
.description('render the given file')
.option('-o, --output <path>', 'output file path')
.action((file, options) => {
markbinder.renderFile(path.resolve(process.cwd(), file))
.then((result) => {
const formattedResult = htmlBeautify(result, { indent_size: 2 });
if (options.output) {
const outputPath = path.resolve(process.cwd(), options.output);
fs.outputFileSync(outputPath, formattedResult);
logger.logo();
logger.info(`Result was written to ${outputPath}`);
} else {
logger.log(formattedResult);
}
})
.catch((error) => {
logger.error('Error processing file rendering:');
logger.error(error.message);
});
});

program
.command('init [root]')
.description('init a markbind website project')
.action((root) => {
const rootFolder = path.resolve(root || process.cwd());
logger.logo();
Site.initSite(rootFolder)
.then(() => {
logger.info('Initialization success.');
})
.catch((error) => {
logger.error(error.message);
});
});

program
.command('serve [root]')
.description('build then serve a website from a directory')
.option('-p, --port <port>', 'port for server to listen on (Default is 8080)')
.option('--no-open', 'do not automatically open the site in browser')
.action((root, options) => {
const rootFolder = path.resolve(root || process.cwd());
const outputFolder = path.join(rootFolder, '_site');

const site = new Site(rootFolder, outputFolder);

const addHandler = (filePath) => {
logger.info(`Reload for file add: ${filePath}`);
Promise.resolve('').then(() => {
if (fsUtil.isSourceFile(filePath)) {
return site.buildSourceFiles();
}
return site.buildAsset(filePath);
}).catch((err) => {
logger.error(err.message);
});
};

const changeHandler = (filePath) => {
logger.info(`Reload for file change: ${filePath}`);
Promise.resolve('').then(() => {
if (fsUtil.isSourceFile(filePath)) {
return site.rebuildSourceFiles(filePath);
}
return site.buildAsset(filePath);
}).catch((err) => {
logger.error(err.message);
});
};

const removeHandler = (filePath) => {
logger.info(`Reload for file deletion: ${filePath}`);
Promise.resolve('').then(() => {
if (fsUtil.isSourceFile(filePath)) {
return site.rebuildSourceFiles(filePath);
}
return site.removeAsset(filePath);
}).catch((err) => {
logger.error(err.message);
});
};

// server conifg
const serverConfig = {
open: options.open,
logLevel: 0,
root: outputFolder,
port: options.port || 8080,
mount: [],
};

logger.logo();

site
.readSiteConfig()
.then((config) => {
serverConfig.mount.push([config.baseUrl || '/', outputFolder]);
return site.generate();
})
.then(() => {
const watcher = chokidar.watch(rootFolder, {
ignored: [outputFolder, /(^|[/\\])\../],
ignoreInitial: true,
});
watcher
.on('add', addHandler)
.on('change', changeHandler)
.on('unlink', removeHandler);
})
.then(() => {
const server = liveServer.start(serverConfig);
server.addListener('listening', () => {
const address = server.address();
const serveHost = address.address === '0.0.0.0' ? '127.0.0.1' : address.address;
const serveURL = `http://${serveHost}:${address.port}`;
logger.info(`Serving "${outputFolder}" at ${serveURL}`);
logger.info('Press CTRL+C to stop ...');
});
})
.catch((error) => {
logger.error(error.message);
});
});

program
.command('deploy')
.description('deploy the site to the repo\'s Github pages.')
.action(() => {
const rootFolder = path.resolve(process.cwd());
const outputRoot = path.join(rootFolder, '_site');
new Site(rootFolder, outputRoot).deploy()
.then(() => {
logger.info('Deployed!');
})
.catch((err) => {
logger.error(err.message);
});
logger.logo();
});

program
.command('build [root] [output]')
.description('build a website')
.action((root, output) => {
const rootFolder = path.resolve(root || process.cwd());
const defaultOutputRoot = path.join(rootFolder, '_site');
const outputFolder = output ? path.resolve(process.cwd(), output) : defaultOutputRoot;
logger.logo();
new Site(rootFolder, outputFolder)
.generate()
.then(() => {
logger.info('Build success!');
})
.catch((error) => {
logger.error(error.message);
});
});

program.parse(process.argv);

if (!program.args.length || !ACCEPTED_COMMANDS.includes(process.argv[2])) {
if (program.args.length) {
logger.warn(`Command '${program.args[0]}' doesn't exist, run "markbind help" to list commands.`);
} else {
logger.logo();
program.help();
}
}
Loading