public static @NotNull SnippetMarkup fromElement(@NotNull PsiElement element) {
    if (!(element instanceof PsiFile) && !(element instanceof PsiSnippetDocTagBody)) {
      throw new IllegalArgumentException();
    }
    return CachedValuesManager.getCachedValue(element, () -> {
      SnippetMarkup markup = element instanceof PsiSnippetDocTagBody body ? parse(preparse(body), body) :
                             parse(preparse(element.getText()), element);
      return new CachedValueProvider.Result<>(markup, element);
    });
  }
public static @NotNull SnippetMarkup fromElement(@NotNull PsiElement element)