github.com/anakojm/hugo-katex@v0.0.0-20231023141351-42d6f5de9c0b/CONTRIBUTING.md (about) 1 >**Note:** We would apprecitate if you hold on with any big refactorings (like renaming deprecated Go packages), mainly because of potential for extra merge work for future coming in in the near future. 2 3 # Contributing to Hugo 4 5 We welcome contributions to Hugo of any kind including documentation, themes, 6 organization, tutorials, blog posts, bug reports, issues, feature requests, 7 feature implementations, pull requests, answering questions on the forum, 8 helping to manage issues, etc. 9 10 The Hugo community and maintainers are [very active](https://github.com/gohugoio/hugo/pulse/monthly) and helpful, and the project benefits greatly from this activity. We created a [step by step guide](https://gohugo.io/tutorials/how-to-contribute-to-hugo/) if you're unfamiliar with GitHub or contributing to open source projects in general. 11 12 *Note that this repository only contains the actual source code of Hugo. For **only** documentation-related pull requests / issues please refer to the [hugoDocs](https://github.com/gohugoio/hugoDocs) repository.* 13 14 *Changes to the codebase **and** related documentation, e.g. for a new feature, should still use a single pull request.* 15 16 ## Table of Contents 17 18 * [Asking Support Questions](#asking-support-questions) 19 * [Reporting Issues](#reporting-issues) 20 * [Submitting Patches](#submitting-patches) 21 * [Code Contribution Guidelines](#code-contribution-guidelines) 22 * [Git Commit Message Guidelines](#git-commit-message-guidelines) 23 * [Fetching the Sources From GitHub](#fetching-the-sources-from-github) 24 * [Building Hugo with Your Changes](#building-hugo-with-your-changes) 25 26 ## Asking Support Questions 27 28 We have an active [discussion forum](https://discourse.gohugo.io) where users and developers can ask questions. 29 Please don't use the GitHub issue tracker to ask questions. 30 31 ## Reporting Issues 32 33 If you believe you have found a defect in Hugo or its documentation, use 34 the GitHub issue tracker to report 35 the problem to the Hugo maintainers. If you're not sure if it's a bug or not, 36 start by asking in the [discussion forum](https://discourse.gohugo.io). 37 When reporting the issue, please provide the version of Hugo in use (`hugo 38 version`) and your operating system. 39 40 - [Hugo Issues · gohugoio/hugo](https://github.com/gohugoio/hugo/issues) 41 - [Hugo Documentation Issues · gohugoio/hugoDocs](https://github.com/gohugoio/hugoDocs/issues) 42 - [Hugo Website Theme Issues · gohugoio/hugoThemesSite](https://github.com/gohugoio/hugoThemesSite/issues) 43 44 ## Code Contribution 45 46 Hugo has become a fully featured static site generator, so any new functionality must: 47 48 * be useful to many. 49 * fit naturally into _what Hugo does best._ 50 * strive not to break existing sites. 51 * close or update an open [Hugo issue](https://github.com/gohugoio/hugo/issues) 52 53 If it is of some complexity, the contributor is expected to maintain and support the new feature in the future (answer questions on the forum, fix any bugs etc.). 54 55 Any non-trivial code change needs to update an open [issue](https://github.com/gohugoio/hugo/issues). A non-trivial code change without an issue reference with one of the labels `bug` or `enhancement` will not be merged. 56 57 Note that we do not accept new features that require [CGO](https://github.com/golang/go/wiki/cgo). 58 We have one exception to this rule which is LibSASS. 59 60 **Bug fixes are, of course, always welcome.** 61 62 ## Submitting Patches 63 64 The Hugo project welcomes all contributors and contributions regardless of skill or experience level. If you are interested in helping with the project, we will help you with your contribution. 65 66 ### Code Contribution Guidelines 67 68 Because we want to create the best possible product for our users and the best contribution experience for our developers, we have a set of guidelines which ensure that all contributions are acceptable. The guidelines are not intended as a filter or barrier to participation. If you are unfamiliar with the contribution process, the Hugo team will help you and teach you how to bring your contribution in accordance with the guidelines. 69 70 To make the contribution process as seamless as possible, we ask for the following: 71 72 * Go ahead and fork the project and make your changes. We encourage pull requests to allow for review and discussion of code changes. 73 * When you’re ready to create a pull request, be sure to: 74 * Sign the [CLA](https://cla-assistant.io/gohugoio/hugo). 75 * Have test cases for the new code. If you have questions about how to do this, please ask in your pull request. 76 * Run `go fmt`. 77 * Add documentation if you are adding new features or changing functionality. The docs site lives in `/docs`. 78 * Squash your commits into a single commit. `git rebase -i`. It’s okay to force update your pull request with `git push -f`. 79 * Ensure that `mage check` succeeds. [Travis CI](https://travis-ci.org/gohugoio/hugo) (Windows, Linux and macOS) will fail the build if `mage check` fails. 80 * Follow the **Git Commit Message Guidelines** below. 81 82 ### Git Commit Message Guidelines 83 84 This [blog article](https://cbea.ms/git-commit/) is a good resource for learning how to write good commit messages, 85 the most important part being that each commit message should have a title/subject in imperative mood starting with a capital letter and no trailing period: 86 *"js: Return error when option x is not set"*, **NOT** *"returning some error."* 87 88 Most title/subjects should have a lower-cased prefix with a colon and one whitespace. The prefix can be: 89 90 * The name of the package where (most of) the changes are made (e.g. `media: Add text/calendar`) 91 * If the package name is deeply nested/long, try to shorten it from the left side, e.g. `markup/goldmark` is OK, `resources/resource_transformers/js` can be shortened to `js`. 92 * If this commit touches several packages with a common functional topic, use that as a prefix, e.g. `errors: Resolve correct line numbers`) 93 * If this commit touches many packages without a common functional topic, prefix with `all:` (e.g. `all: Reformat Go code`) 94 * If this is a documentation update, prefix with `docs:`. 95 * If nothing of the above applies, just leave the prefix out. 96 97 Also, if your commit references one or more GitHub issues, always end your commit message body with *See #1234* or *Fixes #1234*. 98 Replace *1234* with the GitHub issue ID. The last example will close the issue when the commit is merged into *master*. 99 100 An example: 101 102 ```text 103 tpl: Add custom index function 104 105 Add a custom index template function that deviates from the stdlib simply by not 106 returning an "index out of range" error if an array, slice or string index is 107 out of range. Instead, we just return nil values. This should help make the 108 new default function more useful for Hugo users. 109 110 Fixes #1949 111 ``` 112 113 ### Fetching the Sources From GitHub 114 115 Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build. The easiest is to clone Hugo in a directory outside of `GOPATH`, as in the following example: 116 117 ```bash 118 mkdir $HOME/src 119 cd $HOME/src 120 git clone https://github.com/gohugoio/hugo.git 121 cd hugo 122 go install 123 ``` 124 125 For some convenient build and test targets, you also will want to install Mage: 126 127 ```bash 128 go install github.com/magefile/mage 129 ``` 130 131 Now, to make a change to Hugo's source: 132 133 1. Create a new branch for your changes (the branch name is arbitrary): 134 135 ```bash 136 git checkout -b iss1234 137 ``` 138 139 1. After making your changes, commit them to your new branch: 140 141 ```bash 142 git commit -a -v 143 ``` 144 145 1. Fork Hugo in GitHub. 146 147 1. Add your fork as a new remote (the remote name, "fork" in this example, is arbitrary): 148 149 ```bash 150 git remote add fork git@github.com:USERNAME/hugo.git 151 ``` 152 153 1. Push the changes to your new remote: 154 155 ```bash 156 git push --set-upstream fork iss1234 157 ``` 158 159 1. You're now ready to submit a PR based upon the new branch in your forked repository. 160 161 ### Building Hugo with Your Changes 162 163 Hugo uses [mage](https://github.com/magefile/mage) to sync vendor dependencies, build Hugo, run the test suite and other things. You must run mage from the Hugo directory. 164 165 ```bash 166 cd $HOME/go/src/github.com/gohugoio/hugo 167 ``` 168 169 To build Hugo: 170 171 ```bash 172 mage hugo 173 ``` 174 175 To install hugo in `$HOME/go/bin`: 176 177 ```bash 178 mage install 179 ``` 180 181 To run the tests: 182 183 ```bash 184 mage hugoRace 185 mage -v check 186 ``` 187 188 To list all available commands along with descriptions: 189 190 ```bash 191 mage -l 192 ``` 193 194 **Note:** From Hugo 0.43 we have added a build tag, `extended` that adds **SCSS support**. This needs a C compiler installed to build. You can enable this when building by: 195 196 ```bash 197 HUGO_BUILD_TAGS=extended mage install 198 ````