kangax / kangax/html-minifier

Error when using in source code examples

Open
#1,150 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
5k
Forks
577
PR merge metrics
No merged PRs in 30d

Description

I'm working in eleventy with "html-minifier": "^4.0.0" and when I tried to create the prod release I've got error with this code:

      <div id="content" class="prose text-slate-800 max-w-none">
        <h1>How to resolve the algorithm 100 doors step by step  in the 11l programming language</h1>
<p>There are 100 doors in a row that are all initially closed.
You make 100 passes by the doors.
The first time through, visit every door and  toggle  the door  (if the door is closed,  open it;   if it is open,  close it).
The second time, only visit every 2nd door   (door #2, #4, #6, ...),   and toggle it.<br>
The third time, visit every 3rd door   (door #3, #6, #9, ...), etc,   until you only visit the 100th door.</p>
<p>Answer the question:   what state are the doors in after the last pass?   Which are open, which are closed?</p>
<p>Alternate:<br>
As noted in this page's   discussion page,   the only doors that remain open are those whose numbers are perfect squares.
Opening only those doors is an   optimization   that may also be expressed;
however, as should be obvious, this defeats the intent of comparing implementations across programming languages.</p>
<p>Let's start with the solution:</p>
<h2>Step by Step solution about How to resolve the algorithm 100 doors step by step  in the 11l programming language</h2>
<h2>Source code in the 11l programming language</h2>
<pre class="language-11l"><code class="language-11l"><span class="highlight-line">V doors = [0B] * 100</span>
<span class="highlight-line">L(i) 100</span>
<span class="highlight-line">   L(j) (i .< 100).step(i + 1)</span>
<span class="highlight-line">      doors[j] = !doors[j]</span>
<span class="highlight-line">   print(‘Door ’(i + 1)‘: ’(I doors[i] {‘open’} E ‘close’))</span>
<span class="highlight-line"></span>
<span class="highlight-line">  </span></code></pre>

    </div>

The error is:

  1. Having trouble writing to "dist/How_to_resolve_the_algorithm_100_doors_step_by_step__in_the_11l_programming_language/index.html" from "./src/posts/How_to_resolve_the_algorithm_100_doors_step_by_step__in_the_11l_programming_language.md" (via EleventyTemplateError)
    2023-11-26T16:59:55.369191Z [11ty] 2. Transform minifyHtml encountered an error when transforming ./src/posts/How_to_resolve_the_algorithm_100_doors_step_by_step__in_the_11l_programming_language.md. (via EleventyTransformError)
    2023-11-26T16:59:55.369402Z [11ty] 3. Parse Error: < 100).step(i + 1)
    2023-11-26T16:59:55.369576Z [11ty] doors[j] = !doors[j]
    2023-11-26T16:59:55.369719Z [11ty] print(‘Door ’(i + 1)‘: ’(I doors[i] {‘open’} E ‘close’))
    2023-11-26T16:59:55.369886Z [11ty]
    2023-11-26T16:59:55.370017Z [11ty]

The error is when using html-minifier I, isolate the error here: https://kangax.github.io/html-minifier/ with the same code above:
image

Any suggestion to resolve the issue?
Regards

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported Parse Error using the HTML-minifier isolate page and the provided code block containing the “< 100” expression. Start by checking how html-minifier handles source-code content inside pre/code elements; done means the example minifies without treating the code as HTML, with regression coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.