docsify-corner
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "docsify-corner", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A plugin for setting corner of docsify.", | ||
@@ -5,0 +5,0 @@ "main": "dist/docsify-corner.js", |
108
README.md
# docsify-corner | ||
Docsify plugin for corner configuration· enhancement. | ||
![docsify](https://github.com/docsifyjs/docsify/raw/develop/docs/_media/icon.svg) | ||
*A [Docsify](https://docsify.js.org/) plugin for corner configuration enhancement based on [Docsify repo configuration](https://docsify.js.org/#/configuration?id=repo).* | ||
- [x] support more icon. ( `Gitlab`...etc) | ||
- [x] support customized image(`png`、`jpg`、`gif`). | ||
[![](https://data.jsdelivr.com/v1/package/npm/docsify-corner/badge)](https://www.jsdelivr.com/package/npm/docsify-corner) | ||
## Usage | ||
### Import | ||
Import one of the script in `index.html`. | ||
```html | ||
<script src="//cdn.jsdelivr.net/npm/docsify-corner/dist/docsify-corner.js"></script> | ||
``` | ||
```html | ||
<script src="//cdn.jsdelivr.net/npm/docsify-corner/dist/docsify-corner.min.js"></script> | ||
``` | ||
### Configuration | ||
Options: | ||
| Option | Description | | ||
| ------ | ----------------------------------- | | ||
| icon | the icon you want show the corner. | | ||
| url | the url for corner link to. | | ||
| width | the width of the customized image. | | ||
| height | the height of the customized image. | | ||
#### Use the preset icons | ||
Current support default corner. | ||
| Name | icon | | ||
| -------- | ------ | | ||
| `Github` | github | | ||
| `Gitlab` | gitlab | | ||
| `Spring` | spring | | ||
| `Golang` | golang | | ||
```html | ||
<script> | ||
window.$docsify = { | ||
repo:'true', // set the docsify show the corner | ||
corner: { | ||
// the icon link url to another site | ||
url: "https://gitlab.com/gitlab-org/gitlab-svgs", | ||
// the default preset icon in docsify-corner | ||
icon: "gitlab", | ||
}, | ||
}; | ||
</script> | ||
``` | ||
--- | ||
#### Use the customized image | ||
You can set your own image in the corner. | ||
```html | ||
<script> | ||
window.$docsify = { | ||
repo:'true', | ||
corner: { | ||
url: "https://github.com/Koooooo-7/docsify-corner", | ||
// you can set the image link here | ||
icon: "https://github.githubassets.com/images/icons/emoji/unicode/1f48a.png", | ||
// the size of the image | ||
width: 80, | ||
height: 80 | ||
}, | ||
}; | ||
</script> | ||
``` | ||
--- | ||
### Contribution | ||
It is hard to adjust the icon to fit the corner to me, so If you wanna add more preset icons, welcome ! | ||
This the current [svg icon resources](https://gitlab.com/gitlab-org/gitlab-svgs) I m working on. | ||
Steps : | ||
- Folk it ! | ||
- Install dependencies `npm run install`. | ||
- Create your feature branch: `git checkout -b my-new-feature`. | ||
- Commit your changes: `git commit -am 'Add some feature'.` | ||
- Push to the branch: `git push origin my-new-feature`. | ||
- Submit a pull request. | ||
--- | ||
### License | ||
MIT [@Koy](https://github.com/Koooooo-7) | ||
@@ -31,2 +31,7 @@ | ||
if (icon === 'golang') { | ||
return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><g fill-rule="evenodd" transform="translate(11,0) rotate(45) scale(0.5)"><path d="m14 15.01h1v-8.02c0-3.862-3.134-6.991-7-6.991-3.858 0-7 3.13-7 6.991v8.02h1v-8.02c0-3.306 2.691-5.991 6-5.991 3.314 0 6 2.682 6 5.991v8.02m-10.52-13.354c-.366-.402-.894-.655-1.48-.655-1.105 0-2 .895-2 2 0 .868.552 1.606 1.325 1.883.102-.321.226-.631.371-.93-.403-.129-.695-.507-.695-.953 0-.552.448-1 1-1 .306 0 .58.138.764.354.222-.25.461-.483.717-.699m9.04-.002c.366-.401.893-.653 1.479-.653 1.105 0 2 .895 2 2 0 .867-.552 1.606-1.324 1.883-.101-.321-.225-.632-.37-.931.403-.129.694-.507.694-.952 0-.552-.448-1-1-1-.305 0-.579.137-.762.353-.222-.25-.461-.483-.717-.699" fill="#fff"/><path d="m5.726 7.04h1.557v.124c0 .283-.033.534-.1.752-.065.202-.175.391-.33.566-.35.394-.795.591-1.335.591-.527 0-.979-.19-1.355-.571-.376-.382-.564-.841-.564-1.377 0-.547.191-1.01.574-1.391.382-.382.848-.574 1.396-.574.295 0 .57.06.825.181.244.12.484.316.72.586l-.405.388c-.309-.412-.686-.618-1.13-.618-.399 0-.733.138-1 .413-.27.27-.405.609-.405 1.015 0 .42.151.766.452 1.037.282.252.587.378.915.378.28 0 .531-.094.754-.283.223-.19.347-.418.373-.683h-.94v-.535m2.884.061c0-.53.194-.986.583-1.367.387-.381.853-.571 1.396-.571.537 0 .998.192 1.382.576.386.384.578.845.578 1.384 0 .542-.194 1-.581 1.379-.389.379-.858.569-1.408.569-.487 0-.923-.168-1.311-.505-.426-.373-.64-.861-.64-1.465m.574.007c0 .417.14.759.42 1.028.278.269.6.403.964.403.395 0 .729-.137 1-.41.272-.277.408-.613.408-1.01 0-.402-.134-.739-.403-1.01-.267-.273-.597-.41-.991-.41-.392 0-.723.137-.993.41-.27.27-.405.604-.405 1m-.184 3.918c.525.026.812.063.812.063.271.025.324-.096.116-.273 0 0-.775-.813-1.933-.813-1.159 0-1.923.813-1.923.813-.211.174-.153.3.12.273 0 0 .286-.037.81-.063v.477c0 .268.224.5.5.5.268 0 .5-.223.5-.498v-.252.25c0 .268.224.5.5.5.268 0 .5-.223.5-.498v-.478m-1-1.023c.552 0 1-.224 1-.5 0-.276-.448-.5-1-.5-.552 0-1 .224-1 .5 0 .276.448.5 1 .5" fill="#fff"/></g></svg>' | ||
} | ||
// if the icon is not in the preset, it should be the image url | ||
const width = cornerOptions.width ? cornerOptions.width : cornerOptions.height ? cornerOptions.height : 100 | ||
@@ -33,0 +38,0 @@ const heitht = cornerOptions.height ? cornerOptions.height : cornerOptions.width ? cornerOptions.width : 100 |
16733
150
109