Skip to content

Commit

Permalink
Use a better example in the README
Browse files Browse the repository at this point in the history
  • Loading branch information
stepchowfun committed Mar 13, 2024
1 parent ad41989 commit 19145c5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ Tagref works with any programming language, and it respects your `.gitignore` fi
Tagref allows you to annotate your code with *tags* (in comments) which can be *referenced* from other parts of the codebase. For example, you might have a tag like this:

```python
# [tag:cities_nonempty] There should be at least one city here.
cities = ['San Francisco', 'Tokyo']
# [tag:polynomial_nonzero] This function never returns zero.
def polynomial(x):
return x ** 2 + 1
```

Elsewhere, suppose you're writing some code which depends on that fact. You can make that clear by referencing the tag:
Elsewhere (possibly in a different file), suppose you're writing some code which depends on that fact. You can make that clear by referencing the tag:

```python
first_city = cities[0] # This is safe due to [ref:cities_nonempty].
def inverse_polynomial(x):
return 1 / polynomial(x) # This is safe due to [ref:polynomial_nonzero].
```

To help you manage these tags and references, Tagref checks the following:
Expand Down

0 comments on commit 19145c5

Please sign in to comment.