mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 19:38:23 +00:00 
			
		
		
		
	Enable the [same paste features](https://github.com/github/paste-markdown#paste-markdown-objects) that GitHub has, notably the ability to paste text containing HTML links and have them automatically turn into Markdown links. As far as I can tell, previous paste features all work as expected. --------- Signed-off-by: silverwind <me@silverwind.io>
		
			
				
	
	
		
			15 lines
		
	
	
		
			1007 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			1007 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import {removeAttachmentLinksFromMarkdown} from './EditorUpload.ts';
 | |
| 
 | |
| test('removeAttachmentLinksFromMarkdown', () => {
 | |
|   expect(removeAttachmentLinksFromMarkdown('a foo b', 'foo')).toBe('a foo b');
 | |
|   expect(removeAttachmentLinksFromMarkdown('a [x](attachments/foo) b', 'foo')).toBe('a  b');
 | |
|   expect(removeAttachmentLinksFromMarkdown('a  b', 'foo')).toBe('a  b');
 | |
|   expect(removeAttachmentLinksFromMarkdown('a [x](/attachments/foo) b', 'foo')).toBe('a  b');
 | |
|   expect(removeAttachmentLinksFromMarkdown('a  b', 'foo')).toBe('a  b');
 | |
| 
 | |
|   expect(removeAttachmentLinksFromMarkdown('a <img src="attachments/foo"> b', 'foo')).toBe('a  b');
 | |
|   expect(removeAttachmentLinksFromMarkdown('a <img width="100" src="attachments/foo"> b', 'foo')).toBe('a  b');
 | |
|   expect(removeAttachmentLinksFromMarkdown('a <img src="/attachments/foo"> b', 'foo')).toBe('a  b');
 | |
|   expect(removeAttachmentLinksFromMarkdown('a <img src="/attachments/foo" width="100"/> b', 'foo')).toBe('a  b');
 | |
| });
 |