Skip to content

Commit

Permalink
docs: Style and content updates (HumanSignal#5407)
Browse files Browse the repository at this point in the history
style and content updates to open source and enterprise docs

---------

Co-authored-by: Hugues Tennier <[email protected]>
Co-authored-by: caitlin_wheeless <[email protected]>
Co-authored-by: caitlin_wheeless <[email protected]>
  • Loading branch information
4 people authored May 8, 2024
1 parent 8090c77 commit 46c944f
Show file tree
Hide file tree
Showing 418 changed files with 2,965 additions and 14,517 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,6 @@ docker-compose.override.yml

# actions-hub
.github/actions-hub

# Local Netlify folder
.netlify
44 changes: 24 additions & 20 deletions docs/netlify.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
[[redirects]]
from = "https://heartex-docs.netlify.app/api/*"
to = "https://app.heartex.com/docs/api/:splat"
status = 301
force = true
from = "https://heartex-docs.netlify.app/api/*"
to = "https://app.heartex.com/docs/api/:splat"
status = 301
force = true

[[redirects]]
from = "https://docs.humansignal.com/api/*"
to = "https://app.heartex.com/docs/api/:splat"
status = 301
force = true
from = "https://docs.humansignal.com/api/*"
to = "https://app.heartex.com/docs/api/:splat"
status = 301
force = true

[[redirects]]
from = "/guide/starter_cloud"
to = "https://humansignal.com/platform/starter-cloud/manage"
status = 301
force = true
from = "/guide/starter_cloud"
to = "https://humansignal.com/platform/starter-cloud/manage"
status = 301
force = true

[[redirects]]
from = "/"
to = "/guide"
status = 301
force = true
from = "/"
to = "/guide"
status = 301
force = true

[[redirects]]
from = "/*"
to = "/404.html"
status = 404
from = "/*"
to = "/404.html"
status = 404

[dev]
command = "yarn start"
targetPort = 4000
77 changes: 77 additions & 0 deletions docs/netlify/edge-functions/open-graph-image.tsx

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/scripts/breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ var fs = require('hexo-fs');
var fm = require('front-matter')

module.exports = function(ctx) {
return function includeTag({pageType, parentPage, currentPage}) {
const parentFile = `${pageType}/${parentPage}.md`;
return function includeTag({pageType, parentPage, currentPage, parentPageExtension = "md"}) {
const parentFile = `${pageType}/${parentPage}.${parentPageExtension}`;
var path = pathFn.join(ctx.source_dir, parentFile);

// exit if path is not defined
Expand All @@ -26,4 +26,4 @@ module.exports = function(ctx) {
</nav>
`
};
};
};
45 changes: 45 additions & 0 deletions docs/scripts/getRecentReleaseNotes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
var HTMLParser = require("node-html-parser");

hexo.extend.helper.register('getRecentReleaseNotes', function() {

const compareVersions = (a, b) => {
const versionRegExp = /(?<x>\d+)?\.(?<y>\d+)?\.(?<z>\d+)?(?<t>\.dev|dev-|-|\.post)?(?<n>\d+)?/;
const aMatch = a.fileName.match(versionRegExp);
const bMatch = b.fileName.match(versionRegExp);
const toInt = (a, d) => a.groups[d]? a.groups[d] * 1 : 0;
for (let d of ['x', 'y', 'z', 'n']) {
const aMatchInt = toInt(aMatch, d);
const bMatchInt = toInt(bMatch, d);
if (aMatchInt === bMatchInt)
continue;
return bMatchInt - aMatchInt;
}
return 0
};

const data = this.site.pages.filter(page => page.source.includes('release_notes') && !page.source.includes('index.md'));

const releaseNotes = data.map((note) => {

const fileName = note.source.split("/")[3];
if(!fileName) return;

const template = HTMLParser.parse(note.content);

const h2 = template.querySelector("h2")
const title = h2.text;
const id = h2.id;

return {
fileName,
title,
id
}
})

releaseNotes.sort(compareVersions);

const recentReleaseNotes = releaseNotes.slice(0, 3);

return recentReleaseNotes;
});
63 changes: 36 additions & 27 deletions docs/scripts/release-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,44 @@ const fs = require("hexo-fs");
const concatMd = require("concat-md");

hexo.extend.filter.register("after_init", async function () {
const compareVersions = (a, b) => {
const versionRegExp = /(?<x>\d+)?\.(?<y>\d+)?\.(?<z>\d+)?(?<t>\.dev|dev-|-|\.post)?(?<n>\d+)?/;
const aMatch = a.match(versionRegExp);
const bMatch = b.match(versionRegExp);
const toInt = (a, d) => a.groups[d]? a.groups[d] * 1 : 0;
for (let d of ['x', 'y', 'z', 'n']) {
const aMatchInt = toInt(aMatch, d);
const bMatchInt = toInt(bMatch, d);
if (aMatchInt === bMatchInt)
continue;
return bMatchInt - aMatchInt;
}
return 0
};

const markdownFiles = await concatMd.default(
"source/guide/release_notes/onprem", {sorter: compareVersions}
);

const frontmatter = `---
const compareVersions = (a, b) => {
const versionRegExp =
/(?<x>\d+)?\.(?<y>\d+)?\.(?<z>\d+)?(?<t>\.dev|dev-|-|\.post)?(?<n>\d+)?/;
const aMatch = a.match(versionRegExp);
const bMatch = b.match(versionRegExp);
const toInt = (a, d) => (a.groups[d] ? a.groups[d] * 1 : 0);
for (let d of ["x", "y", "z", "n"]) {
const aMatchInt = toInt(aMatch, d);
const bMatchInt = toInt(bMatch, d);
if (aMatchInt === bMatchInt) continue;
return bMatchInt - aMatchInt;
}
return 0;
};

const markdownFiles = await concatMd.default(
"source/guide/release_notes/onprem",
{ sorter: compareVersions, joinString: "\n\n\n\n\n\n-----newfile-----" }
);

const wrappedPages = markdownFiles
.split("\n-----newfile-----")
.map(
(page) =>
`<div class="release-note"><button class="release-note-toggle"></button>${page}</div>`
)
.join("");

const frontmatter = `---
NOTE: Don't change release_notes.md manually, it's automatically built from onprem/*.md files on hexo server run!
title: On-Premises Release Notes for Label Studio Enterprise
short: On-Prem Release Notes
type: guide
tier: enterprise
order: 0
order_enterprise: 999
section: "Reference"
order_enterprise: 451
section: "What's New"
meta_title: On-premises release notes for Label Studio Enterprise
meta_description: Review new features, enhancements, and bug fixes for on-premises Label Studio Enterprise installations.
---
Expand All @@ -43,10 +52,10 @@ meta_description: Review new features, enhancements, and bug fixes for on-premis
`;

const finalString = frontmatter + markdownFiles;
const finalString = frontmatter + wrappedPages;

//writing to file
fs.writeFile("source/guide/release_notes.md", finalString, (err) => {
console.log(err);
});
//writing to file
fs.writeFile("source/guide/release_notes.md", finalString, (err) => {
console.log(err);
});
});

This file was deleted.

Loading

0 comments on commit 46c944f

Please sign in to comment.