Skip to content

Commit

Permalink
Merge pull request #6 from BoyWithSilverWings/feature/filename
Browse files Browse the repository at this point in the history
Feature/filename
  • Loading branch information
agneym authored Sep 21, 2019
2 parents d02d3b4 + 34a2281 commit 71fb43d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ Frontmatter level props on a document always takes precedence over Repository le
Just as in CSS your frontmatter or Repo level prop can contain:

```
background: linear-gradient(to right, #ec008c, #fc6767);
background: 'linear-gradient(to right, #ec008c, #fc6767)'
```

2. **What if I need an image as background?**

Write the CSS for it.

```
background: url(https://example.com/image.png)
background: 'url(https://example.com/image.png)'
```

3. **What about font sizes?**
Expand Down
13 changes: 11 additions & 2 deletions __tests__/generate-html.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("Generate HTML", () => {
expect(result.includes(`slot="title"`)).toBe(true);
});

it(`creates large payload`, () => {
it(`creates html output for large payload`, () => {
const result = generateHtml({
assetPath: "demo/",
componentUrl: "https://unpkg.com/@agney/og-image-element@0.2.0",
Expand All @@ -47,7 +47,16 @@ describe("Generate HTML", () => {
subtitle: "Works with Markdown files",
imageUrl: "https://avatars3.githubusercontent.com/u/8883368?s=40&v=4"
});
expect(result).toBeTruthy();
});

it("adds gradient as background", () => {
const result = generateHtml({
background: "linear-gradient(to right, #000428, #004e92)"
});
console.log(result);
expect(true).toBe(true);
expect(result.includes("linear-gradient(to right, #000428, #004e92)")).toBe(
true
);
});
});
2 changes: 1 addition & 1 deletion demo/test-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ogImage:
title: Generating open graph images with Github Actions
subtitle: Works with Markdown files
imageUrl: https://avatars3.githubusercontent.com/u/8883368?s=40&v=4
background: red
background: "linear-gradient(to right, #000428, #004e92)"
fontColor: yellow
fontSize: 90%
filename: this-file
Expand Down
Binary file modified demo/this-file.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/find-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ async function findFile() {
const markdownFiles = filesList.filter(file => {
return FORMATS.some(format => file.filename.endsWith(format));
});

const frontmatterAttributes = getAttributes(markdownFiles);

return frontmatterAttributes.filter(
Expand Down
7 changes: 0 additions & 7 deletions src/github-event.ts

This file was deleted.

0 comments on commit 71fb43d

Please sign in to comment.