Skip to content

Commit

Permalink
add action-option doc
Browse files Browse the repository at this point in the history
  • Loading branch information
drmingdrmer committed Mar 5, 2021
1 parent 4ebeead commit a20f032
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 3 deletions.
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: drmingdrmer/md2zhihu@v0.2
- uses: drmingdrmer/md2zhihu@v0.4
env:
GITHUB_USERNAME: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
Expand All @@ -44,6 +44,46 @@ or access the branch on the web:
https://github.com/drmingdrmer/drmingdrmer.github.io/blob/_md2zhihu/md/_md2zhihu/dict-cmp.md


### Options

- `pattern`:

file pattern to convert

**required**: True
**default**: `**/*.md`

- `output_dir`:

dir to store converted markdown

**required**: True
**default**: `_md2zhihu`

- `md_branch`:

The branch name to push converted markdown to. A build overrides previous built branch. If you want to persist the built markdowns, merge this branch.

**required**: True
**default**: `_md2zhihu/md`

- `asset_branch`:

The branch name in which assets are stored.

**required**: True
**default**: `_md2zhihu/asset`

- `target_platform`:

The platform that the converted markdown should be compatible to.
Currently supported platforms are zhihu, wechat, weibo, simple. `simple` converts almost everything to images and removes most text styles. E.g. inline code block is converted to normal text.

**required**: True
**default**: `zhihu`



## Use it Locally

System requirement: MaxOS
Expand Down
36 changes: 36 additions & 0 deletions action-doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
- `pattern`:

file pattern to convert

**required**: True
**default**: `**/*.md`

- `output_dir`:

dir to store converted markdown

**required**: True
**default**: `_md2zhihu`

- `md_branch`:

The branch name to push converted markdown to. A build overrides previous built branch. If you want to persist the built markdowns, merge this branch.

**required**: True
**default**: `_md2zhihu/md`

- `asset_branch`:

The branch name in which assets are stored.

**required**: True
**default**: `_md2zhihu/asset`

- `target_platform`:

The platform that the converted markdown should be compatible to.
Currently supported platforms are zhihu, wechat, weibo, simple. `simple` converts almost everything to images and removes most text styles. E.g. inline code block is converted to normal text.

**required**: True
**default**: `zhihu`

2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
pattern:
description: 'file pattern to convert'
required: true
default: '*.md'
default: '**/*.md'

output_dir:
description: 'dir to store converted markdown'
Expand Down
21 changes: 21 additions & 0 deletions make-action-doc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python
# coding: utf-8

import yaml

with open("action.yml", 'r') as f:
cont = f.read()

y = yaml.load(cont)

with open("action-doc.md", 'w') as f:

for k, v in y['inputs'].items():
f.write("- `{k}`:".format(k=k))
f.write("\n")
f.write("\n")
f.write(" {description}\n".format(description=v['description'].strip()))
f.write("\n")
f.write(" **required**: {required}\n **default**: `{default}`".format(**v))
f.write("\n")
f.write("\n")
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "0.1.26"
__version__ = "0.4"
__name__ = "md2zhihu"

0 comments on commit a20f032

Please sign in to comment.