modulepackage
0.0.0-20250208055624-7217eeed4ec3
Repository: https://github.com/rcrowley/frag.git
Documentation: pkg.go.dev
# README
Frag
Extract fragments of HTML documents.
For example, given this test.html
:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hello, world!</title>
</head>
<body>
<article>
<h1>Hello, world!</h1>
<p>Lovely day for a test, isn’t it?</p>
</article>
</body>
</html>
And this use of Frag:
frag '<h1>' test.html
You get this fragment of the HTML document:
<h1>Hello, world!</h1>
Installation
go install github.com/rcrowley/frag@latest
Usage
frag [-d|-i] [-o <output>] <tag> <input>
-d
: wrap the fragment in a complete HTML document-i
: unwrap the fragment to leave only its inner HTML-o <output>
: write to this file instead of standard output<tag>
: tag (optionally with attributes) at the root of the fragment to extract<input>
: input HTML file
See also
Frag is part of the Mergician suite of tools that manipulate HTML documents:
- Deadlinks: Scan a document root directory for dead links
- Electrostatic: Mergician-powered, pure-HTML CMS
- Feed: Scan a document root directory to construct an Atom feed
- Sitesearch: Index a document root directory and serve queries to it in AWS Lambda
# Functions
No description provided by the author