Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Shenlin
/
markdown-view
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
lintry
2018-02-23 17:31:00 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ce744ea9df88aed903ad282536c5021a9e763fed
ce744ea9
1 parent
c8074be4
增加命令行主题参数
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
bin/mdview
bin/mdview
View file @
ce744ea
...
...
@@ -14,8 +14,8 @@ program
.
command
(
'export <markdown_file> [html_file]'
)
.
alias
(
'e'
)
.
description
(
'export markdown to html'
)
.
option
(
'-
A --abstract'
,
'abstract to current path
'
)
.
action
(
function
(
md
,
html
)
{
.
option
(
'-
T --theme [theme_name]'
,
'css theme for html
'
)
.
action
(
function
(
md
,
html
,
options
)
{
//判断目标输出参数
if
(
!
fs
.
existsSync
(
md
))
{
console
.
error
(
chalk
.
red
(
md
+
' is not found'
));
...
...
@@ -33,7 +33,8 @@ program
fs
.
ensureFileSync
(
output
);
const
viewer
=
new
(
require
(
'../lib/view-markdown'
))(
process
.
cwd
(),
{
inline
:
true
});
let
result
=
viewer
.
render
(
md
,
'metro-lake'
);
let
theme
=
options
.
theme
||
'news'
;
let
result
=
viewer
.
render
(
md
,
theme
);
fs
.
writeFile
(
output
,
result
);
console
.
log
(
'html is exported to'
,
chalk
.
green
(
output
))
...
...
Please
register
or
login
to post a comment