Skip to content

Commit

Permalink
chore: remove rimraf devDep, format with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
webketje committed Jan 30, 2022
1 parent 13e3dbf commit 796a7f0
Show file tree
Hide file tree
Showing 10 changed files with 225 additions and 229 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ extends:
parserOptions:
ecmaVersion: 2017
rules:
no-console: error
no-console: error
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
name: Bug report
about: Create a report to help us improve

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behaviour:

1. Config
2. Build
3. See error
Expand All @@ -20,8 +20,9 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Environment**
- Mac, Linux, Windows, etc.
- Node.js and npm version

- Mac, Linux, Windows, etc.
- Node.js and npm version

**Additional context**
Add any other context about the problem here.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: Feature request
about: Suggest an idea for this project

---

**Is your feature request related to a problem? Please describe.**
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ stages:
- lint
- test_windows
- test
- codecov
- codecov

jobs:
include:
Expand Down
20 changes: 10 additions & 10 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Expand Down
1 change: 1 addition & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ Tell us what you've done
- Updated documentation

---

For **Added functionality** and **API changes** make sure the documentation has been updated accordingly.
39 changes: 22 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,28 @@ A Metalsmith plugin that applies a custom permalink pattern to files, and rename
## Installation

NPM:

```bash
npm install @metalsmith/permalinks
```

Yarn:

```bash
yarn add @metalsmith/permalinks
```

## Usage

```js
const Metalsmith = require('metalsmith');
const permalinks = require('@metalsmith/permalinks');
const Metalsmith = require('metalsmith')
const permalinks = require('@metalsmith/permalinks')

const metalsmith = new Metalsmith(__dirname).use(
permalinks({
pattern: ':title'
})
);
)
```

The `pattern` can contain a reference to any piece of metadata associated with the file by using the `:PROPERTY` syntax for placeholders.
Expand All @@ -39,11 +42,11 @@ If no pattern is provided, the files won't be remapped, but the `path` metadata
The `pattern` can also be set as such:

```js
const Metalsmith = require('metalsmith');
const permalinks = require('@metalsmith/permalinks');
const Metalsmith = require('metalsmith')
const permalinks = require('@metalsmith/permalinks')

Metalsmith(__dirname)
.use(permalinks({
Metalsmith(__dirname).use(
permalinks({
// original options would act as the keys of a `default` linkset,
pattern: ':title',
date: 'YYYY',
Expand All @@ -60,7 +63,8 @@ Metalsmith(__dirname)
pattern: 'pages/:title'
}
]
}));
})
)
```

### Dates
Expand All @@ -73,7 +77,7 @@ metalsmith.use(
pattern: ':date/:title',
date: 'YYYY'
})
);
)
```

It uses [moment.js](https://momentjs.com/docs/#/displaying/format/) to format the string.
Expand All @@ -93,7 +97,7 @@ metalsmith.use(
lower: false
}
})
);
)
```

The following makes everything snake-case but allows `'` to be converted to `-`
Expand All @@ -109,8 +113,9 @@ metalsmith.use(
}
}
})
);
)
```

#### Handling special characters

If your pattern parts contain special characters like `:` or `=`, specifying `slug.strict` as `true` is a quick way to remove them:
Expand All @@ -123,7 +128,7 @@ metalsmith.use(
strict: true
}
})
);
)
```

#### Custom 'slug' function
Expand All @@ -137,7 +142,7 @@ metalsmith.use(
pattern: ':title',
slug: require('transliteration').slugify
})
);
)
```

There are plenty of other options on npm for transliteration and slugs. <https://www.npmjs.com/browse/keyword/transliteration>.
Expand Down Expand Up @@ -224,7 +229,7 @@ metalsmith.use(
permalinks({
indexFile: 'alt.html'
})
);
)
```

### Ensure files have unique URIs
Expand Down Expand Up @@ -255,8 +260,8 @@ Where `uniqueFunction` takes the form:
```js
const uniqueFunction = (path, files, filename, options) => {
return `path/index.html`;
};
return `path/index.html`
}
```
### Error when there's a URI conflict
Expand Down Expand Up @@ -318,4 +323,4 @@ To use this plugin with the Metalsmith CLI, add `@metalsmith/permalinks` to the
[codecov-badge]: https://img.shields.io/coveralls/github/metalsmith/permalinks
[codecov-url]: https://coveralls.io/github/metalsmith/permalinks
[license-badge]: https://img.shields.io/github/license/metalsmith/permalinks
[license-url]: LICENSE
[license-url]: LICENSE
Loading

0 comments on commit 796a7f0

Please sign in to comment.