mirror of
https://github.com/foambubble/foam.git
synced 2026-01-11 06:58:11 -05:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b7400c20f | ||
|
|
d2feee8c75 | ||
|
|
2113705fb6 | ||
|
|
4758923188 |
@@ -986,6 +986,15 @@
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "badsketch",
|
||||
"name": "Daniel Wang",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/8953212?v=4",
|
||||
"profile": "https://github.com/badsketch",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
@@ -245,6 +245,7 @@ If that sounds like something you're interested in, I'd love to have you along o
|
||||
<tr>
|
||||
<td align="center"><a href="http://sn3akiwhizper.github.io"><img src="https://avatars.githubusercontent.com/u/102705294?v=4?s=60" width="60px;" alt="sn3akiwhizper"/><br /><sub><b>sn3akiwhizper</b></sub></a><br /><a href="https://github.com/foambubble/foam/commits?author=sn3akiwhizper" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="http://jonathanpberger.com/"><img src="https://avatars.githubusercontent.com/u/41085?v=4?s=60" width="60px;" alt="jonathan berger"/><br /><sub><b>jonathan berger</b></sub></a><br /><a href="https://github.com/foambubble/foam/commits?author=jonathanpberger" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/badsketch"><img src="https://avatars.githubusercontent.com/u/8953212?v=4?s=60" width="60px;" alt="Daniel Wang"/><br /><sub><b>Daniel Wang</b></sub></a><br /><a href="https://github.com/foambubble/foam/commits?author=badsketch" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
],
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"version": "0.20.3"
|
||||
"version": "0.20.4"
|
||||
}
|
||||
|
||||
@@ -4,6 +4,12 @@ All notable changes to the "foam-vscode" extension will be documented in this fi
|
||||
|
||||
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
|
||||
|
||||
## [0.20.4] - 2023-01-04
|
||||
|
||||
Fixes and Improvements:
|
||||
|
||||
- Added support for emoji tags (#1125 - thanks @badsketch)
|
||||
|
||||
## [0.20.3] - 2022-12-19
|
||||
|
||||
Fixes and Improvements:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"type": "git"
|
||||
},
|
||||
"homepage": "https://github.com/foambubble/foam",
|
||||
"version": "0.20.3",
|
||||
"version": "0.20.4",
|
||||
"license": "MIT",
|
||||
"publisher": "foam",
|
||||
"engines": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { isSome } from './core';
|
||||
const HASHTAG_REGEX = /(?<=^|\s)#([0-9]*[\p{L}/_-][\p{L}\p{N}/_-]*)/gmu;
|
||||
const WORD_REGEX = /(?<=^|\s)([0-9]*[\p{L}/_-][\p{L}\p{N}/_-]*)/gmu;
|
||||
const HASHTAG_REGEX = /(?<=^|\s)#([0-9]*[\p{L}\p{Emoji_Presentation}/_-][\p{L}\p{Emoji_Presentation}\p{N}/_-]*)/gmu;
|
||||
const WORD_REGEX = /(?<=^|\s)([0-9]*[\p{L}\p{Emoji_Presentation}/_-][\p{L}\p{Emoji_Presentation}\p{N}/_-]*)/gmu;
|
||||
|
||||
export const extractHashtags = (
|
||||
text: string
|
||||
|
||||
@@ -7,11 +7,13 @@ describe('hashtag extraction', () => {
|
||||
it('returns empty list if no tags are present', () => {
|
||||
expect(extractHashtags('hello world')).toEqual([]);
|
||||
});
|
||||
|
||||
it('works with simple strings', () => {
|
||||
expect(
|
||||
extractHashtags('hello #world on #this planet').map(t => t.label)
|
||||
).toEqual(['world', 'this']);
|
||||
});
|
||||
|
||||
it('detects the offset of the tag', () => {
|
||||
expect(extractHashtags('#hello')).toEqual([{ label: 'hello', offset: 0 }]);
|
||||
expect(extractHashtags(' #hello')).toEqual([{ label: 'hello', offset: 1 }]);
|
||||
@@ -19,21 +21,25 @@ describe('hashtag extraction', () => {
|
||||
{ label: 'hello', offset: 3 },
|
||||
]);
|
||||
});
|
||||
|
||||
it('works with tags at beginning or end of text', () => {
|
||||
expect(
|
||||
extractHashtags('#hello world on this #planet').map(t => t.label)
|
||||
).toEqual(['hello', 'planet']);
|
||||
});
|
||||
|
||||
it('supports _ and -', () => {
|
||||
expect(
|
||||
extractHashtags('#hello-world on #this_planet').map(t => t.label)
|
||||
).toEqual(['hello-world', 'this_planet']);
|
||||
});
|
||||
|
||||
it('supports nested tags', () => {
|
||||
expect(
|
||||
extractHashtags('#parent/child on #planet').map(t => t.label)
|
||||
).toEqual(['parent/child', 'planet']);
|
||||
});
|
||||
|
||||
it('ignores tags that only have numbers in text', () => {
|
||||
expect(
|
||||
extractHashtags('this #123 tag should be ignore, but not #123four').map(
|
||||
@@ -41,7 +47,8 @@ describe('hashtag extraction', () => {
|
||||
)
|
||||
).toEqual(['123four']);
|
||||
});
|
||||
it('supports unicode letters like Chinese charaters', () => {
|
||||
|
||||
it('supports unicode letters like Chinese characters', () => {
|
||||
expect(
|
||||
extractHashtags(`
|
||||
this #tag_with_unicode_letters_汉字, pure Chinese tag like #纯中文标签 and
|
||||
@@ -55,6 +62,24 @@ describe('hashtag extraction', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('supports emoji tags', () => {
|
||||
expect(
|
||||
extractHashtags(`this is a pure emoji #⭐, #⭐⭐, #👍👍🏽👍🏿 some mixed emoji #π🥧, #✅todo
|
||||
#urgent❗ or #❗❗urgent, and some nested emoji #📥/🟥 or #📥/🟢
|
||||
`).map(t => t.label)
|
||||
).toEqual([
|
||||
'⭐',
|
||||
'⭐⭐',
|
||||
'👍👍🏽👍🏿',
|
||||
'π🥧',
|
||||
'✅todo',
|
||||
'urgent❗',
|
||||
'❗❗urgent',
|
||||
'📥/🟥',
|
||||
'📥/🟢',
|
||||
]);
|
||||
});
|
||||
|
||||
it('ignores hashes in plain text urls and links', () => {
|
||||
expect(
|
||||
extractHashtags(`
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
👀*This is an early stage project under rapid development. For updates join the [Foam community Discord](https://foambubble.github.io/join-discord/g)! 💬*
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||
[](#contributors-)
|
||||
[](#contributors-)
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||
|
||||
[](https://foambubble.github.io/join-discord/g)
|
||||
@@ -336,6 +336,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
||||
<tr>
|
||||
<td align="center"><a href="http://sn3akiwhizper.github.io"><img src="https://avatars.githubusercontent.com/u/102705294?v=4?s=60" width="60px;" alt="sn3akiwhizper"/><br /><sub><b>sn3akiwhizper</b></sub></a><br /><a href="https://github.com/foambubble/foam/commits?author=sn3akiwhizper" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="http://jonathanpberger.com/"><img src="https://avatars.githubusercontent.com/u/41085?v=4?s=60" width="60px;" alt="jonathan berger"/><br /><sub><b>jonathan berger</b></sub></a><br /><a href="https://github.com/foambubble/foam/commits?author=jonathanpberger" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/badsketch"><img src="https://avatars.githubusercontent.com/u/8953212?v=4?s=60" width="60px;" alt="Daniel Wang"/><br /><sub><b>Daniel Wang</b></sub></a><br /><a href="https://github.com/foambubble/foam/commits?author=badsketch" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user