Documentation
¶
Overview ¶
Copyright © 2025 Ryan Morehart
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Variables
- func BuildRoutes(ctx context.Context) chi.Router
- func Convert(r io.Reader) (string, error)
- func ConvertConfig(config Config, r io.Reader) (string, error)
- func ConvertHandler() http.HandlerFunc
- func ConvertString(s string) (string, error)
- func IndexHandler(ctx context.Context) http.HandlerFunc
- func Run(ctx context.Context, w io.Writer) error
- func Serve(ctx context.Context, port int) error
- type CLI
- type Config
- type ConvertCmd
- type ServeCmd
Constants ¶
This section is empty.
Variables ¶
var ErrNothingFound = errors.New("nothing found to convert")
Functions ¶
func ConvertHandler ¶
func ConvertHandler() http.HandlerFunc
func ConvertString ¶
func IndexHandler ¶
func IndexHandler(ctx context.Context) http.HandlerFunc
Types ¶
type CLI ¶
type CLI struct {
Serve ServeCmd `cmd:"" help:"Run converter as a server"`
Convert ConvertCmd `cmd:"" default:"" help:"Convert stdin to stdout"`
}
type Config ¶
type Config struct {
// Should whitespace in the original HTML be preserved in the output?
PreserveWhitespace bool
// Prefix calls to helpers functions from gomponents/html
// Period should be included, ie "g."
PrefixHTML string
// Prefix calls to the core Gomponents functions (El, Attr, Text)
// Period should be included, ie "gomponents."
PrefixCore string
}
type ConvertCmd ¶
type ConvertCmd struct{}