Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A PHP Library to Convert HTML to AMP HTML

NotificationsYou must be signed in to change notification settings

paulredmond/html-to-amp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A PHP Library to Convert HTML toAMP HTML

This is a new library and not considered stable yet.

Documentation

See thewiki. 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'smain 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 wonderfulthephpleague/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

About

A PHP Library to Convert HTML to AMP HTML

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp