toDOM works strangely

html {
  counter-reset: czi-cust-style-counter-1;
  counter-reset: czi-cust-style-counter-2;
  counter-reset: czi-cust-style-counter-3;
  counter-reset: czi-cust-style-counter-4;
  counter-reset: czi-cust-style-counter-5;
  counter-reset: czi-cust-style-counter-6;
  counter-reset: czi-cust-style-counter-7;
  counter-reset: czi-cust-style-counter-8;
  counter-reset: czi-cust-style-counter-9;
  counter-reset: czi-cust-style-counter-10;

  --czi-counter-bold: 100;
}

.ProseMirror p[data-style-level='2'] {
  counter-increment: czi-cust-style-counter-2;

  /* Reset all other variables under the current one. */
  counter-reset: czi-cust-style-counter-3;
  counter-reset: czi-cust-style-counter-4;
  counter-reset: czi-cust-style-counter-5;
  counter-reset: czi-cust-style-counter-6;
  counter-reset: czi-cust-style-counter-7;
  counter-reset: czi-cust-style-counter-8;
  counter-reset: czi-cust-style-counter-9;
  counter-reset: czi-cust-style-counter-10;
}

.ProseMirror p[data-style-level='2']::before {
  content: counter(czi-cust-style-counter-1, decimal) '.' counter(czi-cust-style-counter-2, decimal) ' ';
  font-weight: var(--czi-counter-bold);
}

ParagraphNodeSpec’s toDOM function have attrs["data-style-level"] = node.attrs.styleLevel;

With this in place, all work fine and get the desired result in numbering.

Recently removed node attribute ‘styleLevel’ as there is another node attribute ‘styleName’ using which can fetch styleLevel from the style server. Even though seeing dataset ‘styleLevel’ set correctly, czi-cust-style-counter-1 is initialized with 0, when the data-style-level is set to 2, which was working fine earlier ie czi-cust-style-counter-1 used to be initialized with 1. What could be the reason? I spent a lot of time with this. Any quick help appreciated. Thanks for considering!

Please discard the above issue. It was an issue with our code and nothing to do with prosemirror. Sorry for any confusion. Thanks for considering!