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

add numeric icon feature #762

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/steps/rewrite-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import { h } from 'hastscript';
import { CONTINUE, SKIP, visit } from 'unist-util-visit';

const REGEXP_ICON = /(?<!(?:https?|urn)[^\s]*):(#?[a-z_-]+[a-z\d]*):/gi;
const REGEXP_ICON = /(?<!(?:https?|urn)[^\s]*):((?!\d{2}:)[#a-z\d_-]+[a-z\d]*):/gi;

/**
* Create a <span> icon element:
Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/content/icons-ignored.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ <h1 id="icons">Icons</h1>
<pre><code>:rocket:</code></pre>
<p><a href="https://example.test/:urn:">https://example.test/:urn:</a></p>
<p>urn:aaid:sc:VA6C2:ac6066f3-fd1d-4e00-bed3-fa3aa6d981d8</p>
<p>:this is also ignored:</p>
<p>08:28:54</p>
</div>
</main>
</main>
4 changes: 4 additions & 0 deletions test/fixtures/content/icons-ignored.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
[https://example.test/:urn:](https://example.test/:urn:)

urn:aaid:sc:VA6C2:ac6066f3-fd1d-4e00-bed3-fa3aa6d981d8

:this is also ignored:

08:28:54
21 changes: 17 additions & 4 deletions test/fixtures/content/icons.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
<main>
<div>
<h1 id="icons">Icons</h1>
<p>Hello <span class="icon icon-button"></span></p>
<p>Hello <span class="icon icon-red"></span> banner.</p>
<p>Hello <span class="icon icon-check"></span> mark.</p>
<p>Hello<span class="icon icon-button"></span></p>
<p>Hello <span class="icon icon-red"></span>banner.</p>
<p>Hello <span class="icon icon-check"></span>mark.</p>
<p>Team<span class="icon icon-rocket"></span>blasting off again.</p>
<p>This is a <span class="icon icon-a-10-check"></span>that should work</p>
<p>number check<span class="icon icon-1-check"></span></p>
<p>number check<span class="icon icon-two-2-check"></span></p>
<p>number check<span class="icon icon-three-3-check"></span></p>
<p>number check<span class="icon icon-four4check"></span></p>
<p>number check<span class="icon icon-5-check"></span></p>
<p>number check<span class="icon icon-six-6000-check"></span></p>
<p>number check<span class="icon icon-seven7000check"></span></p>
<p>number check<span class="icon icon-8000check"></span></p>
<p>number check<span class="icon icon-nine9000"></span></p>
<p>number check<span class="icon icon-ten-10000"></span></p>
<p>number check<span class="icon icon-eleven-11"></span></p>
<p>number check<span class="icon icon-twelve-v1"></span></p>
</div>
</main>
</main>
26 changes: 26 additions & 0 deletions test/fixtures/content/icons.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,29 @@ Hello :red: banner.
Hello :#check: mark.

Team:rocket:blasting off again.

This is a :a-10-check: that should work

number check :1-check:

number check :two-2-check:

number check :three-3-check:

number check :four4check:

number check :5-check:

number check :six-6000-check:

number check :seven7000check:

number check :8000check:

number check :nine9000:

number check :ten-10000:

number check :eleven-11:

number check :twelve-v1:
Loading