Giter Club home page Giter Club logo

htmlark's People

Contributors

bitlooter avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

htmlark's Issues

add option: do not include comments

right now htmlark adds useful comments about which original file was used before the data-uri.

this is sometimes unecessary (e.g. in production), and maybe even be the default, while the comments can be added with (for example) a --debug option.

thanks

reveal.js support

I've tried to run htmlark on a few reveal.js based presentations (https://github.com/hakimel/reveal.js/).

I found that while in principle it is possible to get results, a lot of features are unsupported and there are many fail cases:

  • data-background not supported (loads external images; is specific to reveal.js; should work with data urls);
  • math plugin is not woking (maybe because it's an external dependency? I didn't try it with a non-CDN version of MathJax yet);
  • fonts are not loaded properly.

Any chance of updating this application adding support for reveal.js? (seems like could be a lot of effort; maybe can collaborate on this.) Anyway, I would like to learn of your thoughts on this. Thanks!

Not all images are serialized

On the page https://www.bbc.co.uk/news/world-africa-51063149

I ran a test and the logo "NEWS" at the top left of the page is not turned into a data url although the picture on the page is.

I did the following:

import htmlark
packed_html = htmlark.convert_page('https://www.bbc.co.uk/news/world-africa-51063149', ignore_errors=True) 

f = open('htmlark_test.html', 'w') 
f.write(packed_html) 
f.close() 

I looked at the documentation and its not totally clear how I can try different parsers like html5lib etc, is it that I'm not using the correct parser here or something else?

Improve handling of absolute paths

Given an HTML file containing a css resource using an aboslute path:
<link rel=stylesheet href=/css/site.css>

Result:

$ htmlark mypage.html
**SS: Error reading '/css/site.css': No such file or directory
Unable to convert webpage: [Errno 2] No such file or directory: '/css/site.css'**

I think htmlark should be able to handle this better.

<img src=''> puts entire HTML document into empty src

Just like the title says. I found that my empty src attribute received a very long base64 string, so I decoded it, and it contains my index.html.

So I tried the recommended approach for empty src's, src='//:0' and got "No such file or directory: '//:0'". (See https://stackoverflow.com/questions/19126185/setting-an-image-src-to-empty/19126281).

Note that src='#' isn't recommended.

So I tried a 1 pixel image, which worked: src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"

Embed iframes

Add the ability to embed linked iframes into pages. Will need to research browser compatibility.

Domain blacklists/whitelists

Add the option to ignore or strip out resources from certain domains, or allow only specified domains. Also should allow the option to ignore all third-party domains during processing. This can be useful for not embedding advertisements or ad tracking scripts into packed files.

convert_page fails on windows if page_path contains drive letter

convert_page fails on windows when called with paths containing drive letter as page_path because it treats the drive letter of a windows path as an url scheme.

Env:

Python 3.7.2
Windows 10

Repro:

import htmlark
htmlark.convert_page('C:\\page.html')

=>

Traceback (most recent call last):
  File "Python37\lib\site-packages\htmlark.py", line 177, in convert_page
    _, page_text = _get_resource(page_path)
  File "Python37\lib\site-packages\htmlark.py", line 77, in _get_resource
    raise ValueError("Not local path or HTTP/HTTPS URL", url_parsed.scheme)
ValueError: ('Not local path or HTTP/HTTPS URL', 'c')

embed CSS as is, not serialized

right now CSS is treated as a binry file, and the embedded code is binhex / data-uri.
bin-hex doesn't conserve space, and cannot be debugged / edited / enhanced.

Please embed CSS as is, between <style> tags, and not serialized.

Thanks!

Integrate logging

Make use of Python's logging module for better integration with programs that import it.

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.