Coder Social home page Coder Social logo

pojntfx / html2goapp Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 3.0 19 MB

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

Home Page: https://pojntfx.github.io/html2goapp/

License: GNU Affero General Public License v3.0

HTML 19.12% Go 76.40% Makefile 3.10% Shell 1.38%
go-app code-generation html-converter

html2goapp's Introduction

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 Felicitas Pojtinger and contributors

SPDX-License-Identifier: AGPL-3.0

html2goapp's People

Contributors

pojntfx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

html2goapp's Issues

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.