Skip to content
Snippets Groups Projects
Unverified Commit 70d0937a authored by syuilo's avatar syuilo
Browse files

Fix #2949

parent 7d1ab610
No related branches found
No related tags found
No related merge requests found
......@@ -9,9 +9,9 @@ export type TextElementHashtag = {
};
export default function(text: string, i: number) {
if (!(/^\s#[^\s\.,]+/.test(text) || (i == 0 && /^#[^\s\.,]+/.test(text)))) return null;
if (!(/^\s#[^\s\.,!\?]+/.test(text) || (i == 0 && /^#[^\s\.,!\?]+/.test(text)))) return null;
const isHead = text.startsWith('#');
const hashtag = text.match(/^\s?#[^\s\.,]+/)[0];
const hashtag = text.match(/^\s?#[^\s\.,!\?]+/)[0];
const res: any[] = !isHead ? [{
type: 'text',
content: text[0]
......
......@@ -122,6 +122,11 @@ describe('Text', () => {
{ type: 'hashtag', content: '#piyo', hashtag: 'piyo' },
{ type: 'text', content: '.' }
], tokens2);
const tokens3 = analyze('#Foo!');
assert.deepEqual([
{ type: 'text', content: '#Foo!' },
], tokens3);
});
it('quote', () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment