This repository has been archived by the owner on Apr 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Ink-33/master
添加对Markdown文件的渲染支持
- Loading branch information
Showing
4 changed files
with
102 additions
and
37 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,8 @@ _cgo_gotypes.go | |
_cgo_export.* | ||
|
||
_testmain.go | ||
|
||
_main.backup.go | ||
*.exe | ||
*.test | ||
*.prof | ||
html2image |
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 |
---|---|---|
@@ -1,38 +1,50 @@ | ||
# html2image | ||
a golang wrapper to reander html to image | ||
a golang wrapper to reander html, markdown to image | ||
|
||
## Usage | ||
|
||
### directly render image | ||
|
||
1. render png | ||
|
||
http://127.0.0.1:8080/to/img.png?url=http://www.google.com | ||
[http://127.0.0.1:10000/v1/html2img/to/img.png?url=http://www.google.com](http://127.0.0.1:10000/v1/html2img/to/img.png?url=http://www.google.com) | ||
|
||
2. render jpg | ||
|
||
http://127.0.0.1:8080/to/img.jpg?url=http://www.google.com | ||
[http://127.0.0.1:10000/v1/html2img/to/img.jpg?url=http://www.google.com](http://127.0.0.1:10000/v1/html2img/to/img.jpg?url=http://www.google.com) | ||
|
||
3. render png (markdown only) | ||
|
||
[http://127.0.0.1:10000/v1/md2img/to/img.png?url=https://github.com/Ink-33/html2image/raw/master/README.md](http://127.0.0.1:10000/v1/md2img/to/img.png?url=https://github.com/Ink-33/html2image/raw/master/README.md) | ||
|
||
4. render jpg (markdown only) | ||
|
||
[http://127.0.0.1:10000/v1/md2img/to/img.jpg?url=https://github.com/Ink-33/html2image/raw/master/README.md](http://127.0.0.1:10000/v1/md2img/to/img.jpg?url=https://github.com/Ink-33/html2image/raw/master/README.md) | ||
|
||
**Notice**: | ||
This program will analyze _markdown_ (when `url` end with `.md`). If you don't want to render a _markdown_ file, please add the `nomd=true` parameter to the url. | ||
|
||
### render image and return image url info | ||
|
||
1. render image and return json | ||
|
||
http://127.0.0.1:8080/api/v1/to/img.json?url=http://www.google.com&format=jpg | ||
[http://127.0.0.1:10000/v1/html2img/to/img.json?url=http://www.google.com&format=jpg](http://127.0.0.1:10000/v1/html2img/to/img.json?url=http://www.google.com&format=jpg) | ||
|
||
2. show image url from the json result | ||
|
||
http://127.0.0.1:8080/show/img/{your image url} | ||
[http://127.0.0.1:10000/v1/html2img/show/img/](http://127.0.0.1:10000/v1/html2img/show/img/){your image url} | ||
|
||
## More Params In Url | ||
```shell | ||
html: the html content to render, if url has set, this param will ignore | ||
md: the markdown content to render, if url has set, | ||
this param will ignore (not support yet) | ||
nomd: ingore markdown url | ||
width: the html page width | ||
height: the html page height | ||
quality: the image quality | ||
|
||
``` | ||
## Changelog | ||
2020/04/23 Add markdown render support. |
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