CLI and web app to convert HTML markup to go-app.dev's syntax.

Overview

HTML to go-app Converter

Logo

CLI and web app to convert HTML markup to go-app.dev's syntax.

hydrun CI Go Reference Matrix Binary Downloads

Installation

CLI

Static binaries are also available on GitHub releases.

You can install them like so:

$ curl -L -o /tmp/html2goapp-cli https://github.com/pojntfx/html2goapp/releases/latest/download/html2goapp-cli.linux-$(uname -m)
$ sudo install /tmp/html2goapp-cli /usr/local/bin

Web App

The frontend is also available on GitHub releases in the form of a static .tar.gz archive; to deploy it, simply upload it to a CDN or copy it to a web server. For most users, this shouldn't be necessary though; thanks to @maxence-charriere's go-app package, html2goapp is a progressive web app. By simply visiting the public deployment once, it will be available for offline use whenever you need it:

Usage

Web App

To convert HTML to go-app's syntax, simply paste the HTML you want to convert into the Source Code input and click on Convert. You may set the component name, go-app package import path and target package using the options.

CLI

You can use the CLI to convert a HTML input file to go-app's syntax like so:

$ html2goapp-cli -component PF4Tabs -src example/index.html -pkg example > example/index.go

If you want to use the WebAssembly version of the CLI, use go_js_wasm_exec:

$ /usr/local/go/misc/wasm/go_js_wasm_exec out/cli/html2goapp-cli.js-wasm.wasm -component PF4Tabs -src example/index.html -pkg example > example/index.go

You can find the example index.html and index.go files in this repository.

Screenshots

Click on an image to see a larger version.

Screenshot of the home screen Screenshot of a complex conversion

Reference

Command Line Arguments

$ html2goapp-cli --help
Usage of html2goapp-cli:
  -component string
        Name of the component to generate (default "MyComponent")
  -goAppPkg string
        Package to use for go-app (default "github.com/maxence-charriere/go-app/v9/pkg/app")
  -pkg string
        Package to generate component in (default "components")
  -src string
        HTML source file to convert (default "index.html")

Acknowledgements

  • This project would not have been possible were it not for @maxence-charriere's go-app package; if you enjoy using html2goapp, please donate to him!
  • The open source PatternFly design system provides the components for the project.
  • dave/jennifer enables this project to generate the Go source code in a simple and declarative way.
  • All the rest of the authors who worked on the dependencies used! Thanks a lot!

Contributing

To contribute, please use the GitHub flow and follow our Code of Conduct.

To build and start a development version of html2goapp locally, run the following:

$ git clone https://github.com/pojntfx/html2goapp.git
$ cd html2goapp
$ make run/pwa # To launch the web app
$ make run/cli # To launch the CLI

Have any questions or need help? Chat with us on Matrix!

Troubleshooting

  • You get the failed to execute 'compile' on 'webassembly': incorrect response mime type. expected 'application/wasm'. error when trying to launch the web app? Please make sure that you have added the WebAssembly MIME type on your webserver.
  • Elements are missing in the generated output? Make sure you only have one root HTML element and do not include the html, head or body tags in your input.

License

html2goapp (c) 2021 Felix Pojtinger and contributors

SPDX-License-Identifier: AGPL-3.0

You might also like...
An alternative syntax to generate YAML (or JSON) from commandline

yo An alternative syntax to generate YAML (or JSON) from commandline. The ultimate commanline YAML (or JSON) generator! ... I'm kidding of course! but

GDScript Syntax Highlighting in GNU Nano

nano-gdscript GDScript Syntax Highlighting in GNU Nano. Updated regularly every minor updates. Contributions are welcomed Installation This is 100% fr

sleep command accepting Go duration syntax.

gsleep sleep command accepting Go duration syntax. Installation go install github.com/forestgagnon/gsleep@latest Usage # Sleep 5 minutes gsleep 5m #

A sample FaaS function that gets a stock quote and 30 day history by symbol and returns a HTML page with a generates SVG sparkline.

faas stonks This uses serverless technology to get a stock quote and 30 day sparkline from Yahoo Finance. Deployment Nimbella account Namespace with o

Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.
Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.

dasel Dasel (short for data-selector) allows you to query and modify data structures using selector strings. Comparable to jq / yq, but supports JSON,

convert curl commands to Python, JavaScript, Go, PHP, R, Dart, Java, MATLAB, Rust, Elixir and more
convert curl commands to Python, JavaScript, Go, PHP, R, Dart, Java, MATLAB, Rust, Elixir and more

curlconverter curlconverter transpiles curl commands into programs in other programming languages. $ curlconverter --data "Hello, world!" example.com

A command line tool that builds and (re)starts your web application everytime you save a Go or template fileA command line tool that builds and (re)starts your web application everytime you save a Go or template file

# Fresh Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go or template file. If the web framework yo

This command line converts .webarchive file to resources embed .html file

webarchive-to-singlefile This command line converts Safari's .webarchive file to complete .html. Notice Only tested on MacOS. Google Chrome required.

This is a Go Cli app that receives an string path to a log file, and based on it generates  and prints in console an encoded polyline with the locations found in the log file.
This is a Go Cli app that receives an string path to a log file, and based on it generates and prints in console an encoded polyline with the locations found in the log file.

GEOENCODE GO CLI APP DESCRIPTION This is a Go Cli app that receives an string path to a log file, and based on it generates and prints in console an e

Comments
  • Some HTML Tag will outputs as wrong lowercase

    Some HTML Tag will outputs as wrong lowercase

    This is a very useful tool, great works! However, I found that some of the tags are marked as lowercase in the transcription process. For example, TBody -> Tbody and FieldSet -> Fieldset.

    Some tags like SVG, will be ignored, but I guess this is caused by the problem that go-app itself doesn't support. Maybe it can translate to RAW or something else.

    opened by ipfans 3
Releases(unstable)
Owner
Felix Pojtinger
20 | They/them | Go & Web Developer
Felix Pojtinger
CLI shorthand syntax for Go

CLI Shorthand Syntax CLI shorthand syntax is a contextual shorthand syntax for passing structured data into commands that require e.g. JSON/YAML. Whil

Daniel G. Taylor 7 Dec 12, 2022
PretGO - asic cli for format json,html and xml!

PretGO So basic cli for format json,html and xml! Table of contents Screenshots Setup Status Contact Screenshots Setup First clone project git clone h

Murat Mirgün ERCAN 32 Sep 2, 2022
CLI tool (hcron) and Go library (cron) to convert CRON expression into human readable description.

cron cron is a Go library that parses a cron expression and outputs a human readable description of the cron schedule. For example, given the expressi

Quy Le 74 Nov 12, 2022
word2text - a tool is to convert word documents (DocX) to text on the CLI with zero dependencies for free

This tool is to convert word documents (DocX) to text on the CLI with zero dependencies for free. This tool has been tested on: - Linux 32bit and 64 bit - Windows 32 bit and 64 bit - OpenBSD 64 bit

Ryan Thomas 5 Apr 19, 2021
CLI tool to convert many common document types to plane text.

Textify. CLI tool to convert many common document types to plane text. Goals. SO many different document types exist today. PDFs, EPUB books, Microsof

Quin 1 Nov 19, 2021
Utility CLI to convert Spring Boot Yaml configuration into external configuration

boot-config-export Utility CLI to convert Spring Boot Yaml configuration into external configuration (as environment variables). The variables are tra

Lucian 0 Nov 17, 2021
argv - Go library to split command line string as arguments array using the bash syntax.

Argv Argv is a library for Go to split command line string into arguments array. Documentation Documentation can be found at Godoc Example func TestAr

null 37 Nov 19, 2022
Generate High Level Cloud Architecture diagrams using YAML syntax.

A commandline tool that generate High Level microservice & serverless Architecture diagrams using a declarative syntax defined in a YAML file.

Luca Sepe 557 Dec 24, 2022
Improved go doc with terminal syntax highlighting

GopherDoc Improved go doc with terminal syntax highlighting. This is a modification of the original go doc command that adds terminal syntax highlight

Raven Ravener 16 Nov 22, 2022