Skip to content

Commit

Permalink
Merge branch 'master' into bump-up-v0.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
funzin committed Aug 21, 2019
2 parents 9fe08e7 + 8ec9203 commit 32dccb3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</p>

## Overview
ImgConverter is chrome extension that converts form image of markdown notation to img tag(`<img>`) when you upload images to issue or Pull Request on Github.
ImgConverter is chrome extension that converts form image of markdown notation to img tag(`<img>`) when you upload images

- Chrome Extensions: [ImgConverter](https://chrome.google.com/webstore/detail/imgconverter-for-github/pkgimcoeodgcdfnidhgijpopkfhbcomm)

Expand All @@ -31,11 +31,17 @@ ImgConverter is chrome extension that converts form image of markdown notation t
- JPEG (.jpg)

## Environment
- javascript
- Javascript
- node(v12.1.0)
- npm(v6.9.0)
- karma(jasmine)

## Confirmed services
- Github
- esa
- Docbase

etc.

## DEMO
![demo](resource/gif/demo.gif)
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ImgConverter for Github",
"name": "ImgConverter",
"short_name": "ImgConverter",
"version": "0.1.3",
"description": "ImgConverter converts from image of markdown notation to to img tag",
Expand Down
8 changes: 4 additions & 4 deletions spec/js/convert-to-img-tag-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ describe("convertToImgTag", function(){
describe('when text contains markdown image', function () {
beforeEach(function () {
text = "hogehoge![title](https://user-images.githubusercontent.com/test0.png)\n \
hogehoge![title](https://user-images.githubusercontent.com/test1.png)"
hogehoge![title](https://img.esa.io/uploads/production/pictures/image/test1.png)"
result = convertToImgTag(text, "")
})
it('should return replaced text', function () {
text = "hogehoge<img src=https://user-images.githubusercontent.com/test0.png >\n \
hogehoge<img src=https://user-images.githubusercontent.com/test1.png >"
hogehoge<img src=https://img.esa.io/uploads/production/pictures/image/test1.png >"
expect(result).toEqual(text)
})
})

describe('when image title contains space', function () {
beforeEach(function () {
text = "hogehoge![hello world](https://user-images.githubusercontent.com/test0.png)\n \
hogehoge![hello world](https://user-images.githubusercontent.com/test1.png)"
hogehoge![hello world](https://img.esa.io/uploads/production/pictures/image/test1.png)"
result = convertToImgTag(text, "")
})
it('should return replaced text', function () {
text = "hogehoge<img src=https://user-images.githubusercontent.com/test0.png >\n \
hogehoge<img src=https://user-images.githubusercontent.com/test1.png >"
hogehoge<img src=https://img.esa.io/uploads/production/pictures/image/test1.png >"
expect(result).toEqual(text)
})
})
Expand Down
2 changes: 1 addition & 1 deletion src/js/convert-to-img-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function convertToImgTag(text, params) {

function createMarkdownImages(text, params) {
let markdownImageArray = []
const results = text.match(/\!\[.*\]\(https:\/\/user-images.githubusercontent.com\S+(jpg|jpeg|png)\)/gmi)
const results = text.match(/\!\[.*\]\(https:\/\/\S+(jpg|jpeg|png)\)/gmi)
if (results == null) { return null}

for (const mdImage of results) {
Expand Down

0 comments on commit 32dccb3

Please sign in to comment.