Skip to content

Commit

Permalink
Merge pull request #17 from ayazhafiz/feature/as-lang
Browse files Browse the repository at this point in the history
feat(Embed): allow embedding files without an extension
  • Loading branch information
zakhenry authored Jul 7, 2019
2 parents 26c15d6 + 9d1951c commit 9b9c258
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/embedme.lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ function getReplacement(
return substr;
}

const matches = commentedFilename.match(/\s?(\S+?\.\S+?)((#L(\d+)-L(\d+))|$)/m);
const matches = commentedFilename.match(/\s?(\S+?)((#L(\d+)-L(\d+))|$)/m);

if (!matches) {
log({ returnSnippet: substr }, chalk.gray(`No file found in first comment block`));
Expand Down
10 changes: 10 additions & 0 deletions test/fixture.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,16 @@ object HelloWorld {

```

## Extension-less selection

```sh
# sample

#!/usr/bin/env bash
print Hello World

```

## Line selection

```cs
Expand Down
2 changes: 2 additions & 0 deletions test/sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
print Hello World

0 comments on commit 9b9c258

Please sign in to comment.