Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing a better data-trim #1756

Merged
merged 2 commits into from
Dec 1, 2016
Merged

Implementing a better data-trim #1756

merged 2 commits into from
Dec 1, 2016

Conversation

jmpp
Copy link
Contributor

@jmpp jmpp commented Nov 22, 2016

Inserting code snippets can sometimes be painful for the developer's indentation of HTML, constrained by the <pre> tag to pull code to the left like this :

  <body>
    <div class="reveal">
      <div class="slides">

          <section>
            <section>
              <pre><code class="js" data-trim>
const fs = require('fs');

fs.writeFile('filename.txt', 'Hello World!', (err) => {
  if (err) throw err;

  console.log('Le contenu du fichier a bien été modifié.');
});
              </code></pre>
            </section>
          </section>

      </div>
    </div>
  </body>

✖ This breaks the editor's code folding, and makes more difficult the reading of the code when working on large presentations.

Now with the new smart data-trim attribute, each code snippet will be processed line-by-line to be automatically reindented to the left :

image

No more pain for the developer to maintain his presentation code indentation, can allow code folding in the editor like you would do in a normal situation :

          <section>
            <section>
              <pre><code class="js" data-trim>
                const fs = require('fs');

                fs.writeFile('filename.txt', 'Hello World!', (err) => {
                  if (err) throw err;

                  console.log('Le contenu du fichier a bien été modifié.');
                });
              </code></pre>
            </section>
          </section>

@jmpp
Copy link
Contributor Author

jmpp commented Nov 25, 2016

@hakimel I read the CONTRIBUTING.md, please let me know if there is any oversight :)
Best.

@hakimel hakimel merged commit 775d510 into hakimel:dev Dec 1, 2016
@hakimel
Copy link
Owner

hakimel commented Dec 1, 2016

This is great. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants