Giter Club home page Giter Club logo

html-to-amp's Introduction

HTML to AMP HTML

A PHP Library to Convert HTML to AMP HTML

This is a new library and not considered stable yet.

Documentation

See the wiki. Documentation is a WIP right now.

Why?

I have a need to convert HTML content into valid AMP (a subset of HTML) format from disparate CMS systems in a (hopefully) somewhat consistent manner. Instead of hacking regular expressions and doing the same thing over and over again, I thought it would be useful to create a library to parse HTML and convert it into AMP HTML.

The library's main purpose is parsing fragments of HTML content (an article body) and converting it into valid AMP. At this point you could try to parse an entire HTML document, but that's not this library's sweet spot. Pull requests are welcomed of course if you find a need; open an issue and discuss your ideas before submitting a PR so I can understand your goals/needs and align them to this project.

Design Goals

  • Make it simple, yet extensible
  • Convert and Replace Elements in a passive way
  • Allow client code to configure which conversions run
  • Allow client code to add custom conversions as needed

Inspiration

This Library was inspired by code design patterns found in the wonderful thephpleague/html-to-markdown PHP library. Generally, the objectives in this Library are similiar: parse HTML into another format—in this case a subset of HTML.

Testing

Build Status

$ vendor/bin/phpspec run

html-to-amp's People

Contributors

paulredmond avatar mgonzo avatar

Watchers

James Cloos avatar Artem Veselkov avatar

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.