Git Product home page Git Product logo

posthtml-beautify's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar

posthtml-beautify's Issues

[feat]: Add dict for tag groups

{
  groups: ['meta', 'script', 'link']
}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

instead

<meta charset="utf-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

[fix]: tree.messages set to undefined after posthtml-beautify done processing

In posthtml.config.js I have multiple plugins, which set tree.messages API property for later usage by posthtml-loader. I also have posthtml-beautify as a last plugin declared in posthtml.config.js.

tree.messages has proper value if there is no posthtml-beautify declared in config, but it has undefined value if I declare posthtml-beautify in a config (I test this value by checking result.messages in a posthtml-loader on this line). So posthtml-beautify somehow interferes with this property, but from the source I yet can not find how exactly

resolve parses Downlevel-revealed and valid version

  • Downlevel-revealed Conditional Comments
<![if !IE]><p>You are not using Internet Explorer.</p><![endif]>

after htmlparser2 return

{ tag: 'p',
  content: [ 'You are not using Internet Explorer.' ] }
  • Valid Downlevel-revealed Conditional Comments
<!--[if !IE]>--><link href="non-ie.css" rel="stylesheet"><!--<![endif]-->
<!--[if gte IE 7]><!--><p>This is shown in downlevel browsers and IE7 or later.</p><!--<![endif]-->

after htmlparser2 return

1: '<!--[if !IE]>-->',
2: { tag: 'link',
     attrs: { href: 'non-ie.css', rel: 'stylesheet' } },
3: '<!--<![endif]-->'
4: '<!--[if gt IE 6]><!-->'
5: 'This code displays on non-IE browsers and on IE 7 or higher.'
6: '<!--<![endif]-->'

incorrect set indent

input html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>instagramator</title>
  <link rel="stylesheet" href="css/main.css">
</head>
<body>
  <module href="src/html/components/btn-outline.html">Анализировать</module>
</body>
</html>

output html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">

    <title>instagramator</title>

    <link rel="stylesheet" href="css/main.css">
  </head>

  <body>

      <button class="btn-outline">
        Анализировать
      </button>

  </body>
</html>

module html

<button class="btn-outline">
  <content></content>
</button>

[feat]: add full list attrs

export default {
    require: {
        status: ['deprecated', 'email'], // email - convert style to old attrs for email
        boolean: true
    }
}

Support sync mode

When I try to use posthtml-beautify with posthtml running in sync mode, I get this error:

Error: Can’t process contents in sync mode because of async plugin:

not pretty if used posthtml-extends

base.html

<html>
    <head>
        <meta charset="utf-8">
        <title><block name="title"></block></title>

        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.0.0/normalize.min.css">
        <link rel="stylesheet" href="css/demo.css">
        <link rel="stylesheet" href="../dist/css/slims.min.css">
    </head>

    <body class="sl-row-12">
        <div class="sl-row-11">
            <nav class="sl-offset-pv-10">
                <a
                    href="/"
                    class="sl-box-inline sl-v-top sl-offset-ph-15 sl-offset-pv-15"
                    >slims
                </a><a
                    href="https://github.com/gitscrum/slims"
                    class="sl-box-inline sl-v-top sl-offset-ph-15 sl-offset-pv-15"
                    >view on GitHub</a>
            </nav>
            <main><block name="content"></block></main>
        </div>
        <footer class="sl-row-1 sl-offset-pv-20"><block name="footer">footer content</block></footer>
    </body>
</html>

index.html

<extends src="layout/base.html">
    <block name="title">slims</block>

    <block name="content">
        <div class="sl-clearfix sl-offset-pv-20">
            <aside class="sl-box-right sl-col-4"><module href="layout/menu.html"></module></aside>
            <section class="sl-box-left sl-col-8">
                <header>
                    <h1 class="sl-offset-mh-0">slims</h1>
                    <p>Vanilla CSS framework</p>
                </header>
            </section>
        </div>
    </block>
</extends>

resutl.html

<html>
    <head>
        <meta charset="utf-8">
        <title>slims</title>

        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.0.0/normalize.min.css">
        <link rel="stylesheet" href="css/demo.css">
        <link rel="stylesheet" href="../dist/css/slims.min.css">
    </head>

    <body class="sl-row-12">
        <div class="sl-row-11">
            <nav class="sl-offset-pv-10">
                <a href="/" class="sl-box-inline sl-v-top sl-offset-ph-15 sl-offset-pv-15">slims
                </a><a href="https://github.com/gitscrum/slims" class="sl-box-inline sl-v-top sl-offset-ph-15 sl-offset-pv-15">view on GitHub</a>
            </nav>
            <main>
    <div class="sl-clearfix sl-offset-pv-20">
      <aside class="sl-box-right sl-col-4">
        <ul>
          <li>test</li>
        </ul>
      </aside>

      <section class="sl-box-left sl-col-8">
        <header>
          <h1 class="sl-offset-mh-0">slims</h1>

          <p>Vanilla CSS framework</p>
        </header>
      </section>
    </div>
  </main>
        </div>
        <footer class="sl-row-1 sl-offset-pv-20">footer content</footer>
    </body>
</html>

add perf for last node on level 0

if (level === 0 && (tree.length - 1) === index) {
    return [...previousValue, node];
}

update to

if (level === 0 && (tree.length - 1) === index) {
    return [...previousValue, getIndent(level), node];
}

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

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.