-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
114 changed files
with
491 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
We as members, contributors, and leaders pledge to make participation in our | ||
community a harassment-free experience for everyone, regardless of age, body | ||
size, visible or invisible disability, ethnicity, sex characteristics, gender | ||
identity and expression, level of experience, education, socio-economic status, | ||
nationality, personal appearance, race, religion, or sexual identity | ||
and orientation. | ||
|
||
We pledge to act and interact in ways that contribute to an open, welcoming, | ||
diverse, inclusive, and healthy community. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to a positive environment for our | ||
community include: | ||
|
||
* Demonstrating empathy and kindness toward other people | ||
* Being respectful of differing opinions, viewpoints, and experiences | ||
* Giving and gracefully accepting constructive feedback | ||
* Accepting responsibility and apologizing to those affected by our mistakes, | ||
and learning from the experience | ||
* Focusing on what is best not just for us as individuals, but for the | ||
overall community | ||
|
||
Examples of unacceptable behavior include: | ||
|
||
* The use of sexualized language or imagery, and sexual attention or | ||
advances of any kind | ||
* Trolling, insulting or derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or email | ||
address, without their explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
## Enforcement Responsibilities | ||
|
||
Community leaders are responsible for clarifying and enforcing our standards of | ||
acceptable behavior and will take appropriate and fair corrective action in | ||
response to any behavior that they deem inappropriate, threatening, offensive, | ||
or harmful. | ||
|
||
Community leaders have the right and responsibility to remove, edit, or reject | ||
comments, commits, code, wiki edits, issues, and other contributions that are | ||
not aligned to this Code of Conduct, and will communicate reasons for moderation | ||
decisions when appropriate. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies within all community spaces, and also applies when | ||
an individual is officially representing the community in public spaces. | ||
Examples of representing our community include using an official e-mail address, | ||
posting via an official social media account, or acting as an appointed | ||
representative at an online or offline event. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported to the community leaders responsible for enforcement at | ||
[email protected]. | ||
All complaints will be reviewed and investigated promptly and fairly. | ||
|
||
All community leaders are obligated to respect the privacy and security of the | ||
reporter of any incident. | ||
|
||
## Enforcement Guidelines | ||
|
||
Community leaders will follow these Community Impact Guidelines in determining | ||
the consequences for any action they deem in violation of this Code of Conduct: | ||
|
||
### 1. Correction | ||
|
||
**Community Impact**: Use of inappropriate language or other behavior deemed | ||
unprofessional or unwelcome in the community. | ||
|
||
**Consequence**: A private, written warning from community leaders, providing | ||
clarity around the nature of the violation and an explanation of why the | ||
behavior was inappropriate. A public apology may be requested. | ||
|
||
### 2. Warning | ||
|
||
**Community Impact**: A violation through a single incident or series | ||
of actions. | ||
|
||
**Consequence**: A warning with consequences for continued behavior. No | ||
interaction with the people involved, including unsolicited interaction with | ||
those enforcing the Code of Conduct, for a specified period of time. This | ||
includes avoiding interactions in community spaces as well as external channels | ||
like social media. Violating these terms may lead to a temporary or | ||
permanent ban. | ||
|
||
### 3. Temporary Ban | ||
|
||
**Community Impact**: A serious violation of community standards, including | ||
sustained inappropriate behavior. | ||
|
||
**Consequence**: A temporary ban from any sort of interaction or public | ||
communication with the community for a specified period of time. No public or | ||
private interaction with the people involved, including unsolicited interaction | ||
with those enforcing the Code of Conduct, is allowed during this period. | ||
Violating these terms may lead to a permanent ban. | ||
|
||
### 4. Permanent Ban | ||
|
||
**Community Impact**: Demonstrating a pattern of violation of community | ||
standards, including sustained inappropriate behavior, harassment of an | ||
individual, or aggression toward or disparagement of classes of individuals. | ||
|
||
**Consequence**: A permanent ban from any sort of public interaction within | ||
the community. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], | ||
version 2.0, available at | ||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. | ||
|
||
Community Impact Guidelines were inspired by [Mozilla's code of conduct | ||
enforcement ladder](https://github.com/mozilla/diversity). | ||
|
||
[homepage]: https://www.contributor-covenant.org | ||
|
||
For answers to common questions about this code of conduct, see the FAQ at | ||
https://www.contributor-covenant.org/faq. Translations are available at | ||
https://www.contributor-covenant.org/translations. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Contributing | ||
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change. | ||
|
||
Please note we have a [Code of Conduct](CODE_OF_CONDUCT.md), please follow it in all your interactions with the project. | ||
|
||
We release new versions of this project (maintenance/features) on a monthly cadence so please be aware that some items will not get released right away. | ||
|
||
# Pull Request Process | ||
You can contribute changes to this repo by opening a pull request: | ||
|
||
1) After forking this repository to your Git account, make the proposed changes on your forked branch. | ||
2) Run tests and linting locally. | ||
- [Install and run Docker](https://docs.docker.com/get-docker/) if you aren't already. | ||
- Run `yarn test:services:start`, allow for the services to come up. | ||
- Run `yarn test`. | ||
3) Commit your changes and push them to your forked repository. | ||
4) Navigate to the main `writr` repository and select the *Pull Requests* tab. | ||
5) Click the *New pull request* button, then select the option "Compare across forks" | ||
6) Leave the base branch set to main. Set the compare branch to your forked branch, and open the pull request. | ||
7) Once your pull request is created, ensure that all checks have passed and that your branch has no conflicts with the base branch. If there are any issues, resolve these changes in your local repository, and then commit and push them to git. | ||
8) Similarly, respond to any reviewer comments or requests for changes by making edits to your local repository and pushing them to Git. | ||
9) Once the pull request has been reviewed, those with write access to the branch will be able to merge your changes into the `writr` repository. | ||
|
||
If you need more information on the steps to create a pull request, you can find a detailed walkthrough in the [Github documentation](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) | ||
|
||
# Code of Conduct | ||
Please refer to our [Code of Conduct](https://github.com/jaredwray/writr/blob/main/CODE_OF_CONDUCT.md) readme for how to contribute to this open source project and work within the community. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,184 +1,57 @@ | ||
 | ||
|
||
--- | ||
> Enabling the world to write better via Markdown | ||
### A Simple to Use Markdown Blog | ||
[](https://github.com/jaredwray/writr/actions/workflows/build.yml) | ||
[](https://github.com/jaredwray/writr/actions/workflows/build.yml) | ||
[](https://github.com/jaredwray/writr/blob/master/LICENSE) | ||
[](https://codecov.io/gh/jaredwray/writr) | ||
[](https://npmjs.com/package/writr) | ||
|
||
--- | ||
# How to Use the Writr Mono Repo | ||
|
||
## Getting Started | ||
Writr provides readme information for each of its packages. In addtion we have a couple of other documents for review: | ||
|
||
## 1. Install Writr | ||
* [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) - Our code of conduct | ||
* [CONTRIBUTING.md](CONTRIBUTING.md) - How to contribute to this project | ||
* [SECURITY.md](SECURITY.md) - Security guidelines and supported versions | ||
|
||
> npm install -g writr | ||
## Getting Started | ||
|
||
## 2. Setup your directory (look at /blog_example for how to do this) | ||
Writr is designed to make it easier to write with Markdown. You can export from many different sources to markdown, and then use Writr to write your content. Writr is designed to be a simple, distraction-free writing environment (in-progress). | ||
|
||
> writr init | ||
## Open a Pull Request | ||
|
||
``` | ||
blog/*.md //markdown files in the folder root | ||
blog/images //images for the blog | ||
blog/config.json //config file (optional) | ||
blog/templates //template directory for your index, post, and tag | ||
``` | ||
You can contribute changes to this repo by opening a pull request: | ||
|
||
## 3. Create your first post | ||
1) After forking this repository to your Git account, make the proposed changes on your forked branch. | ||
2) Run tests and linting locally using `yarn test` | ||
3) Commit your changes and push them to your forked repository. | ||
4) Navigate to the main `writr` repository and select the *Pull Requests* tab. | ||
5) Click the *New pull request* button, then select the option "Compare across forks" | ||
6) Leave the base branch set to main. Set the compare branch to your forked branch, and open the pull request. | ||
7) Once your pull request is created, ensure that all checks have passed and that your branch has no conflicts with the base branch. If there are any issues, resolve these changes in your local repository, and then commit and push them to git. | ||
8) Similarly, respond to any reviewer comments or requests for changes by making edits to your local repository and pushing them to Git. | ||
9) Once the pull request has been reviewed, those with write access to the branch will be able to merge your changes into the `writr` repository. | ||
|
||
> writr new | ||
If you need more information on the steps to create a pull request, you can find a detailed walkthrough in the [Github documentation](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) | ||
|
||
This will allow you to answer a couple questions to setup your first blog post. | ||
## Post an Issue | ||
|
||
## 4. Run Writr on it with defaults. This will output everything to ./blog_output | ||
To post an issue, navigate to the "Issues" tab in the main repository, and then select "New Issue." Enter a clear title describing the issue, as well as a description containing additional relevant information. Also select the label that best describes your issue type. For a bug report, for example, create an issue with the label "bug." In the description field, Be sure to include replication steps, as well as any relevant error messages. | ||
|
||
> writr | ||
If you're reporting a security violation, be sure to check out the project's [security policy](https://github.com/jaredwray/writr/blob/main/SECURITY.md). | ||
|
||
## 5. You can serve your blog with a simple webserver | ||
Please also refer to our [Code of Conduct](https://github.com/jaredwray/writr/blob/main/CODE_OF_CONDUCT.md) for more information on how to report issues. | ||
|
||
> writr serve | ||
## Ask a Question | ||
|
||
## 4. Integrate your blog with Express | ||
To ask a question, create an issue with the label "question." In the issue description, include the related code and any context that can help us answer your question. | ||
|
||
Then in express map your `blog_output` via static files: | ||
## Packages in this Repository | ||
|
||
```javascript | ||
app.use("/blog/*/images", express.static(path.join(__dirname, "blog_output/images"))) | ||
app.use("/blog/images", express.static(path.join(__dirname, "blog_output/images"))) | ||
app.use("/blog", express.static(path.join(__dirname, "blog_output"))) | ||
``` | ||
* [writr-cli](https://github.com/jaredwray/keyv/tree/main/packages/writr-cli): command line interface for exports, rendering, and more with markdown files | ||
|
||
--- | ||
## License | ||
|
||
## CLI | ||
|
||
* -h, --help: Output usage information | ||
* -p, --path: Path of where the blog, and config are located | ||
* -o, --output: Path of where to output the generated blog | ||
* -r, --render: What do you want rendered such as html or json (example --render html,json) | ||
* -c, --config: Configuration file location if different than 'path' | ||
* init: Initialize a new blog | ||
* new: Create a new blog post | ||
* serve: Serve the blog. You can also specify a port with --port and --watch for hot reloading | ||
|
||
## Templates | ||
|
||
There are three templates that are part of every instance of Writr. By default it goes in the `/blog/templates` directory. Here are the files and are in `Handlebars` format: | ||
* index.hjs: This is the main template that lists all of the latest blogs or what you want to add. | ||
* post.hjs: The post itself and usually supporting items around that such as what is next to look at and tags. | ||
* tag.hjs: Showing articles by tag filtering. | ||
|
||
## Template Partials | ||
|
||
You can use template partials such as a header or footer by creating a folder in templates called `partials`. In there create a standard handlebars template file such as `header.hjs`. To reference it go to any of the main template files and include it like `{{> header}}`: | ||
|
||
```html | ||
<h1>Post</h1> | ||
|
||
{{> header}} | ||
|
||
<p>{{post.title}}</p> | ||
<p>{{post.author}}</p> | ||
<p>{{{post.body}}}</p> | ||
|
||
<p>{{post.matter.featured_image}}</p> | ||
|
||
<p>{{previousPost.id}}</p> | ||
<p>{{nextPost.id}}</p> | ||
... | ||
``` | ||
|
||
## Different Templates / Layouts | ||
|
||
You can also set a post to use a different layout by setting the `layout` value in the `front-matter` like so: | ||
|
||
```yaml | ||
--- | ||
title: 'Docula: Persistent Links and Styles!' | ||
tags: | ||
- Github | ||
- Open Source | ||
- Docula | ||
date: 2017-03-07 | ||
layout: post2 | ||
featured_image: Docula_%20Persistent%20Links%20and%20Styles%201.jpeg | ||
--- | ||
``` | ||
|
||
## Permalinks | ||
|
||
In your posts `front-matter` you can specify the format of the url to be generated. By default is the `:title` (also known as the `none` style) that is formatted correctly. | ||
|
||
### Variables | ||
|
||
| Variable | Description | | ||
| --- | ----------- | | ||
| year | Year from the post’s filename with four digits. | | ||
| short_year | Year from the post’s filename without the century. (00..99) | | ||
| month | Month from the post’s filename. (01..12) | | ||
| i_month | Month without leading zeros | | ||
| short_month | Three-letter month abbreviation, e.g. "Dec". | | ||
| long_month | Full month name, e.g. “January”. | | ||
| day | Day of the month from the post’s filename. (01..31) | | ||
| i_day | Day of the month without leading zeros from the post’s filename. | | ||
| y_day | Day of the year (01...365) | | ||
| short_day | Three-letter weekday abbreviation, e.g. “Sun”. | | ||
| long_day | Weekday name, e.g. “Sunday”. | | ||
| week | Week number of the current year, starting with the first week having a majority of its days in January. (01..53) | | ||
| hour | Hour of the day, 24-hour clock, zero-padded from the post’s date front matter. (00..23) | | ||
| minute | Minute of the hour from the post’s date front matter. (00..59) | | ||
| second | Second of the minute from the post’s date front matter. (00..59) | | ||
| title | Title from the document’s front matter. | | ||
|
||
|
||
### Default Styles | ||
|
||
You can simply put in the style on permalink setting in the individual post `front-matter` or globally in `config.json` | ||
|
||
| Style | Template | | ||
| --- | ----------- | | ||
| default | /:title/ | | ||
| date | /:year/:month/:day/:title/ | | ||
| ordinal | /:year/:y_day/:title/ | | ||
|
||
|
||
#### Set Layout it in the Post | ||
|
||
```yaml | ||
--- | ||
title: 'Docula: Persistent Links and Styles!' | ||
tags: | ||
- Github | ||
- Open Source | ||
- Docula | ||
permalink: date | ||
date: 2017-03-07 | ||
layout: post2 | ||
featured_image: Docula_%20Persistent%20Links%20and%20Styles%201.jpeg | ||
--- | ||
``` | ||
|
||
The url will be: `/2017/03/07/docula-persistent-links-and-styles` | ||
|
||
#### Set Layout Globally | ||
|
||
To set it globally you can set it in the `config.json` by setting the `permaLink` variable like so: | ||
```javascript | ||
{ | ||
"output" : "./blog_output", | ||
"render": [ "html" , "json", "atom", "images"], | ||
"path": "./blog_example", | ||
"title": "Example Blog", | ||
"url": "https://writr.io/blog", | ||
"authorName": "Jared Wray", | ||
"authorEmail": "[email protected]", | ||
"permalink": ":year/:month/:title" | ||
} | ||
``` | ||
|
||
## Markdown | ||
To learn more about Markdown go here: https://markdownguide.org | ||
MIT © Jared Wray |
Oops, something went wrong.