JSFiddle - React, Tailwind, and code Playground

HTML

<ol>
<li>تميهد</li>
    <li>
        <ol>حول شركة فضاءات:
            <li>من نحن</li>
            <li>بما نؤمن</li>
            <li>سياستنا</li>
        </ol>
    </li>
    <li>
        <ol>
            <li>One</li>
            <li>Two</li>
            <li>Three</li>
        </ol>
    </li>
    <li>
        <ol>
            <li>One</li>
            <li>Two</li>
            <li>Three</li>
            <li>Four</li>
            <li>Five</li>
        </ol>
    </li>
    <li>
        <ol>
            <li>One</li>
            <li>Two</li>
            <li>Three</li>
            <li>Four</li>
        </ol>
    </li>
     <li>
        <ol>
            <li>One</li>
            <li>Two</li>
            <li>Three</li>
            <li>Four</li>
        </ol>
    </li>
</ol

CSS

body > ol > li {
    margin-bottom: 10px;
}

JavaScript

$("ol").each(function(i) {
    $(this).children("li").not(":has(ol)").each(function(n, el) {
       $(this).prepend("<span>" + i + "." + (n+1) + " </span>");
    });
});