How to write the catalog of documents?

generally speaking, when writing a document, everyone writes it in a variety of different ways.

what I want to ask is something like the following:

1
  1.11.1

2
  2.1 2.1

is it all right to write this for reading and comprehension? Are there any general rules?
(writing specification level, not code implementation)

May.30,2021

well, I have a little demo that is similar to what you said, and can handle the following data structure. I don't know what your data structure is.
Project address:
https://su739.github.io/china/

var su = [
    {
      title: 'c1 - ecmascript',
      children: [
        {
          title: 'c1.1 - Array',
          children: [
            {
              title: 'c1.1.1 - Array.map()',
            },
          ],
        },
      ],
    },
    {
      title: 'c2 - DOM',
      children: [
        {
          title: 'c2.1 - Node',
        },
        {
          title: 'c2.2 - ',
          children: [
            {
              title: 'c2.2.1 - ',
            },
            {
              title: 'c2.2.2 - ',
            },
            {
              title: 'c2.2.3 - EventListener',
            },
          ],
        },
        {
          title: 'c2.3 - DOM3',
        },
      ],
    }
  ];

< H1 > directory < / H1 > < H2 > 1.PHP fundamentals < / H2 >

1.1 PHP environment is built

1.1.1 download installation package

1.1.2 install the software

1.1.3 modify the configuration file

Menu