mirror of https://github.com/usememos/memos
				
				
				
			feat: parser for horizontal rule (#477)
* feat: parser for horizontal rule * chore: revertpull/482/head
							parent
							
								
									66f9bc48bb
								
							
						
					
					
						commit
						797accbc2c
					
				@ -0,0 +1,15 @@
 | 
			
		||||
export const HORIZONTAL_RULES_REG = /^---\n|^\*\*\*\n|^___\n/;
 | 
			
		||||
 | 
			
		||||
export const renderer = (rawStr: string): string => {
 | 
			
		||||
  const matchResult = rawStr.match(HORIZONTAL_RULES_REG);
 | 
			
		||||
  if (!matchResult) {
 | 
			
		||||
    return rawStr;
 | 
			
		||||
  }
 | 
			
		||||
  return `<hr>\n`;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: "horizontal rules",
 | 
			
		||||
  regex: HORIZONTAL_RULES_REG,
 | 
			
		||||
  renderer,
 | 
			
		||||
};
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue