Skip to content

Instantly share code, notes, and snippets.

@brrd
Created April 6, 2020 22:39
Show Gist options
  • Save brrd/651d3151d069432d4327a0ef1141f01d to your computer and use it in GitHub Desktop.
Save brrd/651d3151d069432d4327a0ef1141f01d to your computer and use it in GitHub Desktop.
Paged.js + Hyphenopoly (quick test)
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
@media print {
h1, h2, h3, h4, h5, h6 {
break-after: avoid;
}
p {
text-align: justify;
margin: 0 2em 0 0;
}
.container {
hyphens: auto;
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
}
}
</style>
</head>
<body class="container">
<?php include "text.html";?>
</body>
<script>
window.PagedConfig = {
auto: false
};
</script>
<script src="https://unpkg.com/pagedjs/dist/paged.polyfill.js"></script>
<script>
var Hyphenopoly = {
require: {
"fr": "anticonstitutionnellement"
},
setup: {
selectors: {
".container": {}
}
},
handleEvent: {
"hyphenopolyEnd": function () {
// Run Paged.js after Hyphenopoly
window.PagedPolyfill.preview();
}
}
};
</script>
<script src="./Hyphenopoly-4.2.1/Hyphenopoly_Loader.js"></script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment