code: function getGitlabId(text, repetition) {
    text = text
      .replace(/<(.*)>(.*)<\/\1>/g,"$2") // html tags
      .replace(/!\[.*\]\(.*\)/g,'')      // image tags
      .replace(/\[(.*)\]\(.*\)/,"$1")    // url
      .replace(/\s+/g, '-')              // All spaces are converted to hyphens
      .replace(/[\/?!:\[\]`.,()*"';{}+=<>~\$|#@]/g,'') // All non-word text (e.g., punctuation, HTML) is removed
      .replace(/[。？！，、；：“”【】（）〔〕［］﹃﹄“ ”‘’﹁﹂—…－～《》〈〉「」]/g, '') // remove CJK punctuations
      .replace(/[-]+/g,'-')              // duplicated hyphen
      .replace(/^-/,'')                  // ltrim hyphen
      .replace(/-$/,'');                 // rtrim hyphen
    // If no repetition, or if the repetition is 0 then ignore. Otherwise append '-' and the number.
    if (repetition) {
      text += '-' + repetition;
    }
    return text;
  }
docs: see: https://github.com/gitlabhq/gitlabhq/blob/master/doc/user/markdown.md#header-ids-and-links