Skip to content

Commit 23a48d2

Browse files
committed
Highlight decimals
1 parent f6918ee commit 23a48d2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const highlighters = [
3535
},
3636
{
3737
name: 'number',
38-
regex: /(\d+)/g
38+
regex: /(\d+(?:\.\d+)?)/g
3939
},
4040
{
4141
name: 'string',

index.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ describe('unicode', () => {
3535
.toBe('[number]42[clear]')
3636
})
3737

38+
it('decimals', () => {
39+
expect(hlUni('42.11'))
40+
.toBe('[number]42.11[clear]')
41+
})
42+
3843
it('keywords (uppercase)', () => {
3944
expect(hlUni('SELECT'))
4045
.toBe('[keyword]SELECT[clear]')

0 commit comments

Comments
 (0)