Package hactor provides an http.Handler middleware to render hactor (structured-HTML) to **HTML**, for the Go programming language.
Find a file
2025-10-05 12:43:17 -07:00
actorxml.go actorXML 2025-09-23 13:00:52 -07:00
actorxml_test.go actorXML 2025-09-23 13:00:52 -07:00
fileextension.go hactor.FileExtension 2025-09-23 13:44:20 -07:00
go.mod codeberg 2025-10-05 12:43:17 -07:00
go.sum codeberg 2025-10-05 12:43:17 -07:00
LICENSE initial commits 2025-09-23 12:59:32 -07:00
logger.go codeberg 2025-10-05 12:43:17 -07:00
mediatype.go hactor.MediaType 2025-09-23 13:43:56 -07:00
README.md initial commits 2025-09-23 12:59:32 -07:00
transform.go property="https://www.w3.org/ns/activitystreams#preferredUsername" 2025-09-24 05:38:51 -07:00
transform_test.go property="https://www.w3.org/ns/activitystreams#preferredUsername" 2025-09-24 05:38:51 -07:00
wraphttphandler.go logger 2025-09-23 15:40:30 -07:00

go-hactor

Package hactor provides an http.Handler middleware to render hactor (structured-HTML) to HTML, for the Go programming language.

hactor is an HTML based format for creating ActivityPub / ActivityStreams actors — Application, Feed, Group, Organization, Person, Service, etc.

An example hactor of type Person is:

<x-person>
	<x-name>Joe Blow</x-name>
	<x-handle>spaceace</x-handle>	
	<x-message>
		<p>
			Hello, how do you do?
		</p>
	</x-message>
</x-person>

An example hactor of type Application is:

<x-application>
	<x-name>Joe Blow</x-name>
	<x-handle>spaceace</x-handle>	
	<x-message>
		<p>
			Hello, how do you do?
		</p>
	</x-message>
</x-application>

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/codeberg.org/reiver/go-hactor

GoDoc

Example

Here is an example of using hactor.WrapHTTPHandler() to wrap another handler, to provide hactor (structured-HTML) to HTML rendering.

The http.Handler that hactor.WrapHTTPHandler() returns looks at what the sub-http.Handler to see if the Content-Type it wrote has text/excerpt+html.

import "codeberg.org/reiver/go-hactor"

// ...

var handler http.Handler = ...

handler = hactor.WrapHTTPHandler(handler) // <---------

err := http.ListenAndServe(":8080", handler)
if nil != err {
	return err
}

Import

To import package hactor use import code like the following:

import "codeberg.org/reiver/go-hactor"

Installation

To install package hactor do the following:

GOPROXY=direct go get codeberg.org/reiver/go-hactor

Author

Package hactor was written by Charles Iliya Krempeaux