Update docs

main
Leonid Maslakov 5 months ago
parent 8bea5b38e0
commit 2ab50921fb
  1. 7
      CHANGELOG.md
  2. 45
      README.md
  3. 40
      example_test.go

@ -1,4 +1,9 @@
# Changelog
Semantic versioning is used (https://semver.org/).
**No stable release yet :(**
## v1.0.0
- Added support for С
- Added support for Dockerfile
- Added support for Golang
- Added support for Python
- Added support for `robots.txt`

@ -7,6 +7,11 @@
programming and markup languages inside HTML documents.
## Install
Supported Go versions:
- 1.9
- 1.11
- 1.17
Download from GitHub:
```
go get github.com/lcomrade/highlight
@ -24,6 +29,8 @@ This tag does not do anything on its own,
but you can assign different properties to it in CSS.
Including color and font.
All extraneous HTML tags will be protected.
Before highlighting:
```robots.txt
User-agent: * # comment
@ -53,6 +60,44 @@ After highlighting:
```
## Supported languages
- C
- Dockerfile
- Golang
- Python
- `robots.txt`
## Code example
```golang
package main
import (
"fmt"
"github.com/lcomrade/highlight"
)
func main() {
// Code written in the C language
myCode := `
#include <stdio.h>
// Comment
int main() {
printf("Hello, world!");
return 0;
}
`
// Highlight
fmt.Println(highlight.C(myCode))
}
```
*[Read more in the documentation](https://pkg.go.dev/github.com/lcomrade/highlight#section-documentation)*
## Documentation
- Offline documentation: `go doc -all github.com/lcomrade/highlight`
- [Online documentation](https://pkg.go.dev/github.com/lcomrade/highlight#section-documentation)

@ -0,0 +1,40 @@
// Copyright (C) 2022 Leonid Maslakov.
// This file is part of Highlight.
// Highlight is free software: you can redistribute it
// and/or modify it under the terms of the
// GNU Affero Public License as published by the
// Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
// Highlight is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Affero Public License for more details.
// You should have received a copy of the GNU Affero Public License along with Highlight.
// If not, see <https://www.gnu.org/licenses/>.
package highlight_test
import (
"fmt"
"github.com/lcomrade/highlight"
)
func main() {
// This example uses code written in the C language
myCode := `
#include <stdio.h>
// Comment
int main() {
printf("Hello, world!");
return 0;
}
`
fmt.Println(highlight.C(myCode))
}
Loading…
Cancel
Save