private static @NotNull MarkdownFlavourDescriptor obtainFlavour(@NotNull PsiFile file) {
    if (file instanceof MarkdownFile markdownFile) {
      return markdownFile.getFlavour();
    }
    final var flavour = file.getUserData(MarkdownParserManager.FLAVOUR_DESCRIPTION);
    if (flavour != null) {
      return flavour;
    }
    final var defaultFlavour = MarkdownFlavourUtil.obtainDefaultMarkdownFlavour();
    LOG.error("Markdown flavour was not set for " + file + ". Using default flavour as a fallback: " + defaultFlavour);
    return defaultFlavour;
  }
private static @NotNull MarkdownFlavourDescriptor obtainFlavour(@NotNull PsiFile file)