Package activityhtml provides tools for working with ActivityHTML, for the Go programming language. ActivityHTML is HTML that has ActivityPub / ActivityStream data marked-up or embedded into it using a subset of RDFa Lite (RDFa Super Lite).
Find a file
2025-09-22 12:25:51 -07:00
anchorattributedtotag.go anchorAttributedToTag() 2025-09-22 10:15:59 -07:00
anchorattributedtotag_test.go anchorAttributedToTag() 2025-09-22 10:15:59 -07:00
extractattributedto.go activityhtml.ExtractAttributedTo() 2025-09-22 11:45:26 -07:00
extractattributedto_test.go activityhtml.ExtractAttributedTo() 2025-09-22 11:03:35 -07:00
extractcontent.go activityhtml.ExtractConent() 2025-09-22 04:24:05 -07:00
extractcontent_test.go activityhtml.ExtractConent() 2025-09-22 11:02:23 -07:00
extracthref.go extractHRef() 2025-09-22 06:13:11 -07:00
extracthref_test.go extractHRef() 2025-09-22 06:13:11 -07:00
extractrel.go extractRel() 2025-09-22 10:01:24 -07:00
extractrel_test.go extractRel() 2025-09-22 10:01:24 -07:00
extractto.go activityhtml.ExtractTo() 2025-09-22 02:47:44 -07:00
extracttype.go slight refactor 2025-09-22 09:50:27 -07:00
extracttype_test.go slight refactor 2025-09-22 09:50:27 -07:00
go.mod activityhtml.HTTPHandler 2025-09-22 12:25:51 -07:00
go.sum activityhtml.HTTPHandler 2025-09-22 12:25:51 -07:00
httphandler.go activityhtml.HTTPHandler 2025-09-22 12:25:51 -07:00
indexaftermainend.go activityhtml.ExtractConent() 2025-09-22 11:01:26 -07:00
indexaftermainend_test.go activityhtml.ExtractConent() 2025-09-22 11:01:26 -07:00
indexmainbegin.go indexMainBegin() 2025-09-22 04:05:41 -07:00
indexmainbegin_test.go indexMainBegin() 2025-09-22 04:05:41 -07:00
LICENSE initial commits 2025-09-21 06:54:16 -07:00
maintag.go mainTag() 2025-09-22 02:43:28 -07:00
maintag_test.go mainTag() 2025-09-22 02:43:28 -07:00
README.md docs 2025-09-22 11:14:03 -07:00
skippastmain.go docs 2025-09-21 17:36:53 -07:00
skippastmain_test.go tests 2025-09-21 17:35:02 -07:00
split.go slight refactor 2025-09-22 09:50:27 -07:00
split_test.go slight refactor 2025-09-22 09:50:27 -07:00
unmarshal.go unmarshal() 2025-09-22 12:12:39 -07:00
unmarshal_test.go unmarshal() 2025-09-22 12:12:39 -07:00

go-activityhtml

Package activityhtml provides tools for working with ActivityHTML, for the Go programming language.

ActivityHTML is HTML that has ActivityPub / ActivityStream data marked-up or embedded into it using RDFa.

Documention

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

GoDoc

ActivityHTML

ActivityHTML is ActivityPub / ActivityStream encoded into HTML in a very specific way.

  • https://www.w3.org/ns/activitystreams#content — the HTML <main>
  • https://www.w3.org/ns/activitystreams#type — the value of the RDFa typeof attribute on the HTML <main>
  • https://www.w3.org/ns/activitystreams#attributedTo — the value of the href attribute on <a> with rel https://www.w3.org/ns/activitystreams#attributedTo inside of the HTML <main>

For example:

<main typeof="https://www.w3.org/ns/activitystreams#Note">
	<p>
		Hello world!
	</p>
</main>

That becomes:

{
	"@context": "https://www.w3.org/ns/activitystreams",
	type: "Note",
	content: "<main typeof=\"https://www.w3.org/ns/activitystreams#Note\">\n\t<p>\n\t\tHello world!\n\t</p></main>"
}

And, for example, this:

<main typeof="https://www.w3.org/ns/activitystreams#Note">
	<p>
		Hello world!
	</p>
	<footer>
		<address>
			<a rel="https://www.w3.org/ns/activitystreams#attributedTo" href="http://host.example/@dariush">@[email protected]</a>
		</address>
	</footer>
</main>

Becomes:

{
	"@context": "https://www.w3.org/ns/activitystreams",
	type: "Note",
	content: "<main typeof=\"https://www.w3.org/ns/activitystreams#Note\">\n\t<p>\n\t\tHello world!\n\t</p></main>",
	attributedTo: "http://host.example/@dariush"
}

Import

To import package activityhtml use import code like the following:

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

Installation

To install package activityhtml do the following:

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

Author

Package activityhtml was written by Charles Iliya Krempeaux