Merge pull request #678 from hackmdio/fix-anchor-id-case-sensitive
Fix anchor id to keep uppercase characters
This commit is contained in:
		
						commit
						e38054113e
					
				@ -156,7 +156,11 @@ export function renderTags (view) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function slugifyWithUTF8 (text) {
 | 
					function slugifyWithUTF8 (text) {
 | 
				
			||||||
  let newText = S(text.toLowerCase()).trim().stripTags().dasherize().s
 | 
					  // remove html tags and trim spaces
 | 
				
			||||||
 | 
					  let newText = S(text).trim().stripTags().s
 | 
				
			||||||
 | 
					  // replace all spaces in between to dashes
 | 
				
			||||||
 | 
					  newText = newText.replace(/\s+/g, '-')
 | 
				
			||||||
 | 
					  // slugify string to make it valid for attribute
 | 
				
			||||||
  newText = newText.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, '')
 | 
					  newText = newText.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, '')
 | 
				
			||||||
  return newText
 | 
					  return newText
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user