UNPKG

markugen

Version:

Markdown to HTML/PDF static site generation tool

163 lines (159 loc) 10.3 kB
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta content="width=device-width, initial-scale=1" name="viewport"> <title>Change Log v1</title> <link rel="stylesheet" href="markugen.css"> </head> <body> <h1 id="change-log-v1">Change Log v1</h1> <p>This page will be updated with changes to Markugen upon each new release. The log was started at version 1.1.0 and will be continued for each new release moving forward.</p> <h2 id="v120">v1.2.0</h2> <p>This release fixes a number of issues that were found while working on PDF generation.</p> <h3 id="error-handling">Error Handling</h3> <p>When errors are encountered during construction or generation, they are now thrown. In previous releases, errors would be output to the console and <code>process.exit()</code> was called which would crash your application. This change means you should wrap your Markugen calls in a <code>try/catch</code> block like so:</p> <div class="markugen-code"> <div class="markugen-code-toolbar"> <div class="markugen-code-title">.js</div> <div title="Copy to Clipboard" class="markugen-code-copy" onclick="markugen.copyToClipboard('copy-save-35', this)"> <svg height="24px" viewBox="0 -960 960 960" width="24px" fill="var(--markugen-color)"> <path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h167q11-35 43-57.5t70-22.5q40 0 71.5 22.5T594-840h166q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560h-80v120H280v-120h-80v560Zm280-560q17 0 28.5-11.5T520-800q0-17-11.5-28.5T480-840q-17 0-28.5 11.5T440-800q0 17 11.5 28.5T480-760Z"/> </svg> </div> </div> <pre class="markugen-code-content"><code id="copy-save-35" class="hljs language-js"><span class="hljs-keyword">try</span> { <span class="hljs-keyword">const</span> mark = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Markugen</span>({...}); mark.<span class="hljs-title function_">generateSync</span>(); } <span class="hljs-keyword">catch</span>(e) { <span class="hljs-comment">// handle the error here</span> }</code></pre> </div><h3 id="pdf-generation">PDF Generation</h3> <p>PDF generation was not fully flushed out in previous releases; therefore, some improvements were made to how PDF documents are generated.</p> <ul> <li>Removed the <code>--pdf-only</code> option; generation is either HTML or PDF, not both.</li> <li>During PDF generation, assets are copied over to ensure linked assets like images are embedded in the PDF properly; however, they are removed from the output once generation is complete. The <code>--keep-assets</code> option allows the user to tell Markugen to keep the assets in the output folder after generation is complete.</li> </ul> <h3 id="output-options">Output Options</h3> <p>Two new options were added for customizing the output that is generated:</p> <ul> <li>The <code>--output-format</code> option was added for determining the format of the output that is generated. Previously, if you provided <code>--format string</code> as your input, the output would be a string as well; however, the new option allows you to specify that the output should be a file with the <code>--output-format file</code> option. The <code>--output-format</code> option is only valid when the input format is also <code>string</code> and the <code>--pdf</code> option is <code>false</code>.</li> <li>The <code>--output-name</code> option was added to allow the user to specify the name of the file that is output when <code>--output-format file</code> is used. This option is only valid when <code>--input-format string</code> or the <code>--input</code> path is a single file and not a directory.</li> </ul> <h3 id="miscellaneous">Miscellaneous</h3> <ul> <li>Removed <a target="_blank" href="https://www.npmjs.com/package/shelljs">shelljs</a> package dependency and replaced it with <a target="_blank" href="https://www.npmjs.com/package/fs-extra">fs-extra</a></li> <li>Added a new option <code>--extensions</code> that allows the user to supply a list of extensions to search for documents with. By default, Markugen will search for the <code>md</code> extension only.</li> <li>Previous releases would look for a folder called <code>assets</code> in the <code>--input</code> directory and assume they were assets by adding them to your <code>--assets</code> list automatically. This release no longer looks for the <code>assets</code> folder by default; therefore, you must provide the folder as an asset using the <code>--assets</code> option.</li> <li>Fixed a bug with newlines when using the <code>--format string</code> option with the CLI. When passing a string as input that contained newlines, the newlines were being escaped twice which resulted in output that did not have line breaks where the newlines occurred. This release fixes this behavior so newlines are treated properly in string input.</li> </ul> <h2 id="v112">v1.1.2</h2> <p>This is a very small release that exports some extra utility functions and adds the <code>Markugen.findChrome</code> function as a callable function for use by modules using Markugen.</p> <h2 id="v111">v1.1.1</h2> <p>This is a minor version for fixing issues with PDF generation. </p> <ul> <li>This version allows for <code>Markugen.generate</code> to be asynchronous or synchronous. The method behaves synchronously if the <code>--pdf</code> option is not given. However, if the <code>--pdf</code> option is given, the method will be asynchronous and return a <code>Promise</code>. Additionally, you can call <code>Markugen.generateSync</code> and the method will always be synchronous, but the <code>--pdf</code> option will be ignored.</li> <li>Modified the required modules to use <a target="_blank" href="https://pptr.dev/">Puppeteer Core</a> instead of <code>Puppeteer</code>. This reduces the size of Markugen, but also requires an installation of <a target="_blank" href="https://www.google.com/chrome/">Chrome</a> to be installed on the machine if the <code>--pdf</code> option is given. The path to Chrome is usually detected, but, if not found, the path to your Chrome executable must be given with the <code>--chrome</code> option.</li> </ul> <h2 id="v110">v1.1.0</h2> <p>This version is mostly a fix for print views and adding PDF generation. The reason for the minor increment is due to generation being asynchronous now.</p> <h3 id="async-generation">Async Generation</h3> <p><code>Markugen.generate</code> is now asynchronous and should be awaited:</p> <h5 id="pre-v110">Pre v1.1.0</h5> <div class="markugen-code"> <div class="markugen-code-toolbar"> <div class="markugen-code-title">.ts</div> <div title="Copy to Clipboard" class="markugen-code-copy" onclick="markugen.copyToClipboard('copy-save-36', this)"> <svg height="24px" viewBox="0 -960 960 960" width="24px" fill="var(--markugen-color)"> <path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h167q11-35 43-57.5t70-22.5q40 0 71.5 22.5T594-840h166q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560h-80v120H280v-120h-80v560Zm280-560q17 0 28.5-11.5T520-800q0-17-11.5-28.5T480-840q-17 0-28.5 11.5T440-800q0 17 11.5 28.5T480-760Z"/> </svg> </div> </div> <pre class="markugen-code-content"><code id="copy-save-36" class="hljs language-ts"><span class="hljs-comment">// setup markugen and tell it where to find your files</span> <span class="hljs-keyword">const</span> mark = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Markugen</span>({ <span class="hljs-attr">input</span>: <span class="hljs-string">&#x27;markdown&#x27;</span>, }); <span class="hljs-comment">// generate the website</span> mark.<span class="hljs-title function_">generate</span>();</code></pre> </div><h5 id="post-v110">Post v1.1.0</h5> <div class="markugen-code"> <div class="markugen-code-toolbar"> <div class="markugen-code-title">.ts</div> <div title="Copy to Clipboard" class="markugen-code-copy" onclick="markugen.copyToClipboard('copy-save-37', this)"> <svg height="24px" viewBox="0 -960 960 960" width="24px" fill="var(--markugen-color)"> <path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h167q11-35 43-57.5t70-22.5q40 0 71.5 22.5T594-840h166q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560h-80v120H280v-120h-80v560Zm280-560q17 0 28.5-11.5T520-800q0-17-11.5-28.5T480-840q-17 0-28.5 11.5T440-800q0 17 11.5 28.5T480-760Z"/> </svg> </div> </div> <pre class="markugen-code-content"><code id="copy-save-37" class="hljs language-ts"><span class="hljs-comment">// setup markugen and tell it where to find your files</span> <span class="hljs-keyword">const</span> mark = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Markugen</span>({ <span class="hljs-attr">input</span>: <span class="hljs-string">&#x27;markdown&#x27;</span>, }); <span class="hljs-comment">// generate the website</span> <span class="hljs-keyword">await</span> mark.<span class="hljs-title function_">generate</span>();</code></pre> </div><h3 id="pdf-generation-1">PDF Generation</h3> <p>This release now has two new options: <code>--pdf</code> and <code>--pdf-only</code>. These new options will generate PDF versions of each markdown page given as input. The resulting PDF documents will be linked to each other as well. The <code>--pdf-only</code> option will only generate the PDF files and no HTML files.</p> <h3 id="print-view">Print View</h3> <p>When printing a page from the resulting HTML output, there are a few components that do not react to printing very well.</p> <ol> <li><a class="markugen-md-link" href="./Features/Components.html#code-blocks">Code blocks</a> that present with a scroll bar in the browser due to overflow will be extended in the print view to ensure all code is displayed.</li> <li><a class="markugen-md-link" href="./Features/Components.html#tabs">Tabs</a> will be broken into separate views when printing to ensure all tabs are visible.</li> <li>The table of contents will be moved to the top of the page in print view to provide relative page linking and contents when printing.</li> </ol> <script src="markugen.js"></script> </body> </html>