Skip to content

Commit e6b928a

Browse files
committed
feat: dont underscore numbers
1 parent aef1632 commit e6b928a

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

src/html/usage.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ thread_local! {
2121
}
2222

2323
lazy_static! {
24-
static ref IDENTIFIER_RE: Regex = Regex::new(r"[^a-zA-Z$_]").unwrap();
24+
static ref IDENTIFIER_RE: Regex =
25+
Regex::new(r"^[0-9]|[^a-zA-Z0-9$_]").unwrap();
2526
}
2627

2728
fn render_css_for_usage(name: &str) -> String {

tests/snapshots/html_test__html_doc_files_multiple-66.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ Variables</h2></div><div class="namespaceSection"><div id="namespace_default" cl
105105
</section>
106106
</main><div class="toc">
107107
<div><div class="usageContent">
108-
<h3>Usage</h3><div class="markdown"><pre class="highlight"><code class="language-typescript">import * as bar from &quot;foo&quot;;
109-
</code><button class="context_button" data-copy="import * as bar from &quot;foo&quot;;
108+
<h3>Usage</h3><div class="markdown"><pre class="highlight"><code class="language-typescript">import * as bar123 from &quot;foo&quot;;
109+
</code><button class="context_button" data-copy="import * as bar123 from &quot;foo&quot;;
110110
"><svg class="copy" width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
111111
<rect x="2" y="2" width="7" height="7" fill="none"/>
112112
<rect x="6" y="6" width="7" height="7" fill="none"/>

tests/snapshots/html_test__html_doc_files_multiple-67.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ Type</h2></div><div class="space-y-8"><div class=" docEntry" id="variable_defaul
8787
</article></main>
8888
<div class="toc">
8989
<div><div class="usageContent">
90-
<h3>Usage</h3><div class="markdown"><pre class="highlight"><code class="language-typescript">import bar from &quot;foo&quot;;
91-
</code><button class="context_button" data-copy="import bar from &quot;foo&quot;;
90+
<h3>Usage</h3><div class="markdown"><pre class="highlight"><code class="language-typescript">import bar123 from &quot;foo&quot;;
91+
</code><button class="context_button" data-copy="import bar123 from &quot;foo&quot;;
9292
"><svg class="copy" width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
9393
<rect x="2" y="2" width="7" height="7" fill="none"/>
9494
<rect x="6" y="6" width="7" height="7" fill="none"/>

tests/snapshots/html_test__symbol_group.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8641,7 +8641,7 @@ expression: files
86418641
"usages": [
86428642
{
86438643
"name": "",
8644-
"content": "<div class=\"markdown\"><pre class=\"highlight\"><code class=\"language-typescript\">import bar from &quot;foo&quot;;\n</code><button class=\"context_button\" data-copy=\"import bar from &quot;foo&quot;;\n\"><svg class=\"copy\" width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect x=\"2\" y=\"2\" width=\"7\" height=\"7\" fill=\"none\"/>\n<rect x=\"6\" y=\"6\" width=\"7\" height=\"7\" fill=\"none\"/>\n<path d=\"M1.55566 2.7C1.55566 2.03726 2.09292 1.5 2.75566 1.5H8.75566C9.41841 1.5 9.95566 2.03726 9.95566 2.7V5.1H12.3557C13.0184 5.1 13.5557 5.63726 13.5557 6.3V12.3C13.5557 12.9627 13.0184 13.5 12.3557 13.5H6.35566C5.69292 13.5 5.15566 12.9627 5.15566 12.3V9.9H2.75566C2.09292 9.9 1.55566 9.36274 1.55566 8.7V2.7ZM6.35566 9.9V12.3H12.3557V6.3H9.95566V8.7C9.95566 9.36274 9.41841 9.9 8.75566 9.9H6.35566ZM8.75566 8.7V2.7H2.75566V8.7H8.75566Z\" fill=\"#232323\"/>\n</svg>\n<svg class=\"check\" width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"#232323\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n<path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n<path d=\"M5 12l5 5l10 -10\" />\n</svg>\n</button><code></code></pre>\n</div>",
8644+
"content": "<div class=\"markdown\"><pre class=\"highlight\"><code class=\"language-typescript\">import bar123 from &quot;foo&quot;;\n</code><button class=\"context_button\" data-copy=\"import bar123 from &quot;foo&quot;;\n\"><svg class=\"copy\" width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect x=\"2\" y=\"2\" width=\"7\" height=\"7\" fill=\"none\"/>\n<rect x=\"6\" y=\"6\" width=\"7\" height=\"7\" fill=\"none\"/>\n<path d=\"M1.55566 2.7C1.55566 2.03726 2.09292 1.5 2.75566 1.5H8.75566C9.41841 1.5 9.95566 2.03726 9.95566 2.7V5.1H12.3557C13.0184 5.1 13.5557 5.63726 13.5557 6.3V12.3C13.5557 12.9627 13.0184 13.5 12.3557 13.5H6.35566C5.69292 13.5 5.15566 12.9627 5.15566 12.3V9.9H2.75566C2.09292 9.9 1.55566 9.36274 1.55566 8.7V2.7ZM6.35566 9.9V12.3H12.3557V6.3H9.95566V8.7C9.95566 9.36274 9.41841 9.9 8.75566 9.9H6.35566ZM8.75566 8.7V2.7H2.75566V8.7H8.75566Z\" fill=\"#232323\"/>\n</svg>\n<svg class=\"check\" width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"#232323\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n<path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n<path d=\"M5 12l5 5l10 -10\" />\n</svg>\n</button><code></code></pre>\n</div>",
86458645
"icon": null,
86468646
"additional_css": ""
86478647
}

tests/testdata/multiple/b.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @module bar
2+
* @module bar123
33
*/
44

55
export function x(_n = 0) {}

0 commit comments

Comments
 (0)