kss-modern 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/lib/index.mjs +5 -4
- package/package.json +1 -1
package/dist/node/lib/index.mjs
CHANGED
|
@@ -792,12 +792,13 @@ function extractMarkdownPath(input) {
|
|
|
792
792
|
}
|
|
793
793
|
return path2;
|
|
794
794
|
}
|
|
795
|
+
function compareReferences(a, b) {
|
|
796
|
+
return a.localeCompare(b, void 0, { numeric: true });
|
|
797
|
+
}
|
|
795
798
|
async function parse(input, contentDir) {
|
|
796
799
|
const data = kssParser(input).sections.filter((section) => Boolean(section.reference));
|
|
797
800
|
const overwrittenSectionsIds = [];
|
|
798
|
-
const sortedData = data.sort((a, b) =>
|
|
799
|
-
return a.reference.localeCompare(b.reference);
|
|
800
|
-
});
|
|
801
|
+
const sortedData = data.sort((a, b) => compareReferences(a.reference, b.reference));
|
|
801
802
|
let output = [];
|
|
802
803
|
async function computeDescription(description, rootHeadingLevel) {
|
|
803
804
|
if (!description || !description.includes("Markdown:"))
|
|
@@ -960,7 +961,7 @@ async function parse(input, contentDir) {
|
|
|
960
961
|
output.forEach((firstLevelSection) => {
|
|
961
962
|
firstLevelSection.sections = firstLevelSection.sections.filter((section) => Boolean(section));
|
|
962
963
|
firstLevelSection.sections.forEach((secondLevelSection) => {
|
|
963
|
-
secondLevelSection.sections = secondLevelSection.sections.filter((section) => Boolean(section)).sort((a, b) => a.id
|
|
964
|
+
secondLevelSection.sections = secondLevelSection.sections.filter((section) => Boolean(section)).sort((a, b) => compareReferences(a.id, b.id));
|
|
964
965
|
});
|
|
965
966
|
});
|
|
966
967
|
return {
|