Skip to content
Snippets Groups Projects
PlainNormalizer.ts 527 B
Newer Older
  • Learn to ignore specific revisions
  • import { removeSpacesAndLinebreaks } from "../utils";
    
    export const normalizePlainPart = (text: string): string => {
    
    Gospodin Bodurov's avatar
    Gospodin Bodurov committed
      text = removeListBullets(text);
    
      text = removeSpacesAndLinebreaks(text);
      return removeQRCodes(text);
    };
    
    const removeQRCodes = (s: string): string => {
      return s
    
        .replace(/\[(image:)*qrcode.png]\s*<https:\/\/[\w./?=\-&]+>/g, "")
        .replace(/<https:\/\/[\w./?=\-&]+>\s*\[(image: )*qrcode.png]/g, "");
    
    Gospodin Bodurov's avatar
    Gospodin Bodurov committed
    
    const removeListBullets = (s: string): string => {
    
      return s.replace("\n[o§]\n+/g", "");
    
    Gospodin Bodurov's avatar
    Gospodin Bodurov committed
    };