Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

help: Add FlattenedList for flattening lists without adding Steps.

Shubham Padia925ae0f9b119
diff --git a/starlight_help/src/components/FlattenedList.astro b/starlight_help/src/components/FlattenedList.astro
new file mode 100644
index 00000000000..5e7619995bf
--- /dev/null
+++ b/starlight_help/src/components/FlattenedList.astro
@@ -0,0 +1,42 @@
+---
+import assert from "node:assert/strict";
+
+import {fromHtml} from "hast-util-from-html";
+import {toHtml} from "hast-util-to-html";
+
+const tree = fromHtml(await Astro.slots.render("default"), {fragment: true});
+
+const tree_with_removed_newlines = {
+ type: "root",
+ children: tree.children.filter((child) => {
+ if (child.type === "text" && child.value === "\n") {
+ return false;
+ }
+ return true;
+ }),
+};
+const first_element = tree_with_removed_newlines.children[0];
+assert.ok(
+ first_element?.type === "element" &&
+ ["ol", "ul"].includes(first_element.tagName),
+);
+const flattened = {
+ ...first_element,
+ children: tree_with_removed_newlines.children.flatMap((other) => {
+ if (other.type === "comment") {
+ return [];
+ }
+ assert.ok(other.type === "element");
+ // Flatten only in case of matching tagName, for the rest, we
+ // return the elements without flattening since asides, code
+ // blocks and other elements can be part of a single list item
+ // and we do not want to flatten them.
+ if (other.tagName === first_element.tagName) {
+ return other.children;
+ }
+ return [other];
+ }),
+};
+---
+
+<Fragment set:html={toHtml(flattened)} />
diff --git a/starlight_help/src/components/FlattenedSteps.astro b/starlight_help/src/components/FlattenedSteps.astro
index 72cd78b3acf..9ac3de3a0c7 100644
--- a/starlight_help/src/components/FlattenedSteps.astro
+++ b/starlight_help/src/components/FlattenedSteps.astro
@@ -1,43 +1,7 @@
---
-import assert from "node:assert/strict";
-
import {Steps} from "@astrojs/starlight/components";
-import {fromHtml} from "hast-util-from-html";
-import {toHtml} from "hast-util-to-html";
-
-const tree = fromHtml(await Astro.slots.render("default"), {fragment: true});
-const tree_with_removed_newlines = {
- type: "root",
- children: tree.children.filter((child) => {
- if (child.type === "text" && child.value === "\n") {
- return false;
- }
- return true;
- }),
-};
-const first_element = tree_with_removed_newlines.children[0];
-assert.ok(
- first_element?.type === "element" &&
- ["ol", "ul"].includes(first_element.tagName),
-);
-const flattened = {
- ...first_element,
- children: tree_with_removed_newlines.children.flatMap((other) => {
- if (other.type === "comment") {
- return [];
- }
- assert.ok(other.type === "element");
- // Flatten only in case of matching tagName, for the rest, we
- // return the elements without flattening since asides, code
- // blocks and other elements can be part of a single list item
- // and we do not want to flatten them.
- if (other.tagName === first_element.tagName) {
- return other.children;
- }
- return [other];
- }),
-};
+import FlattenedList from "./FlattenedList.astro";
---
-<Steps><Fragment set:html={toHtml(flattened)} /></Steps>
+<Steps><FlattenedList><slot /></FlattenedList></Steps>
diff --git a/starlight_help/src/content/docs/moving-from-discord.mdx b/starlight_help/src/content/docs/moving-from-discord.mdx
index b23c507ca1c..ca1c4190331 100644
--- a/starlight_help/src/content/docs/moving-from-discord.mdx
+++ b/starlight_help/src/content/docs/moving-from-discord.mdx
@@ -4,9 +4,11 @@ title: Moving from Discord
import {Steps, TabItem, Tabs} from "@astrojs/starlight/components";
+import FlattenedList from "../../components/FlattenedList.astro";
import FlattenedSteps from "../../components/FlattenedSteps.astro";
import ZulipTip from "../../components/ZulipTip.astro";
-import CommunicationPolicies from "../include/_CommunicationPolicies.mdx";
+import CommunicationPoliciesIntro from "../include/_CommunicationPoliciesIntro.mdx";
+import CommunicationPoliciesList from "../include/_CommunicationPoliciesList.mdx";
import ConfigureYourOrganization from "../include/_ConfigureYourOrganization.mdx";
import CreateOrgNoImport from "../include/_CreateOrgNoImport.mdx";
import HowToInviteUsersToJoinNoImport from "../include/_HowToInviteUsersToJoinNoImport.mdx";
@@ -69,22 +71,26 @@ think through the transition process in your own context.
## Review and update communication policies
-<CommunicationPolicies />
-
-* If you've been maintaining a forum in addition to your Discord server, it's
- common to discontinue it when moving to Zulip. Conversations in Zulip are
- organized enough to fulfill the role of a forum, and can be
- [configured](/help/public-access-option) for public access if desired.
-* Zulip makes it easy to find conversations and follow up, so you may be able to
- reduce your reliance on @-mentions. [Silent
- mentions](/help/mention-a-user-or-group#silently-mention-a-user) make it easy
- to refer to someone without calling for their attention.
-* Because in Zulip messages are organized by topic, it’ll generally be clear
- what you’re responding to when you send a message. Consider encouraging users
- to simply send messages to the appropriate topic, rather than
- [replying](/help/replying-to-messages) as in Discord.
-* If moving a community, be sure to check out Zulip's [community moderation
- toolkit](/help/moderating-open-organizations).
+<CommunicationPoliciesIntro />
+
+<FlattenedList>
+ <CommunicationPoliciesList />
+
+ * If you've been maintaining a forum in addition to your Discord server, it's
+ common to discontinue it when moving to Zulip. Conversations in Zulip are
+ organized enough to fulfill the role of a forum, and can be
+ [configured](/help/public-access-option) for public access if desired.
+ * Zulip makes it easy to find conversations and follow up, so you may be able to
+ reduce your reliance on @-mentions. [Silent
+ mentions](/help/mention-a-user-or-group#silently-mention-a-user) make it easy
+ to refer to someone without calling for their attention.
+ * Because in Zulip messages are organized by topic, it’ll generally be clear
+ what you’re responding to when you send a message. Consider encouraging users
+ to simply send messages to the appropriate topic, rather than
+ [replying](/help/replying-to-messages) as in Discord.
+ * If moving a community, be sure to check out Zulip's [community moderation
+ toolkit](/help/moderating-open-organizations).
+</FlattenedList>
## Prepare users for the transition
diff --git a/starlight_help/src/content/docs/moving-from-slack.mdx b/starlight_help/src/content/docs/moving-from-slack.mdx
index d4717df8dbc..8a8a159d035 100644
--- a/starlight_help/src/content/docs/moving-from-slack.mdx
+++ b/starlight_help/src/content/docs/moving-from-slack.mdx
@@ -4,9 +4,11 @@ title: Moving from Slack
import {Steps, TabItem, Tabs} from "@astrojs/starlight/components";
+import FlattenedList from "../../components/FlattenedList.astro";
import FlattenedSteps from "../../components/FlattenedSteps.astro";
import ZulipTip from "../../components/ZulipTip.astro";
-import CommunicationPolicies from "../include/_CommunicationPolicies.mdx";
+import CommunicationPoliciesIntro from "../include/_CommunicationPoliciesIntro.mdx";
+import CommunicationPoliciesList from "../include/_CommunicationPoliciesList.mdx";
import ConfigureYourOrganization from "../include/_ConfigureYourOrganization.mdx";
import HowToInviteUsersToJoinImport from "../include/_HowToInviteUsersToJoinImport.mdx";
import HowToInviteUsersToJoinNoImport from "../include/_HowToInviteUsersToJoinNoImport.mdx";
@@ -96,13 +98,17 @@ made the decision to move to Zulip.
## Review and update communication policies
-<CommunicationPolicies />
+<CommunicationPoliciesIntro />
-* Zulip makes it easy to find conversations and follow up. To avoid disrupting
- focus work, @-mentions in Zulip should generally be reserved for
- time-sensitive messages. [Silent
- mentions](/help/mention-a-user-or-group#silently-mention-a-user) make it easy
- to refer to someone without calling for their attention.
+<FlattenedList>
+ <CommunicationPoliciesList />
+
+ * Zulip makes it easy to find conversations and follow up. To avoid disrupting
+ focus work, @-mentions in Zulip should generally be reserved for
+ time-sensitive messages. [Silent
+ mentions](/help/mention-a-user-or-group#silently-mention-a-user) make it easy
+ to refer to someone without calling for their attention.
+</FlattenedList>
## Prepare users for the transition
diff --git a/starlight_help/src/content/docs/moving-from-teams.mdx b/starlight_help/src/content/docs/moving-from-teams.mdx
index bdd6a092a6d..9f1f5fc4103 100644
--- a/starlight_help/src/content/docs/moving-from-teams.mdx
+++ b/starlight_help/src/content/docs/moving-from-teams.mdx
@@ -4,9 +4,11 @@ title: Moving from Microsoft Teams
import {Steps, TabItem, Tabs} from "@astrojs/starlight/components";
+import FlattenedList from "../../components/FlattenedList.astro";
import FlattenedSteps from "../../components/FlattenedSteps.astro";
import ZulipTip from "../../components/ZulipTip.astro";
-import CommunicationPolicies from "../include/_CommunicationPolicies.mdx";
+import CommunicationPoliciesIntro from "../include/_CommunicationPoliciesIntro.mdx";
+import CommunicationPoliciesList from "../include/_CommunicationPoliciesList.mdx";
import ConfigureYourOrganization from "../include/_ConfigureYourOrganization.mdx";
import CreateOrgNoImport from "../include/_CreateOrgNoImport.mdx";
import HowToInviteUsersToJoinNoImport from "../include/_HowToInviteUsersToJoinNoImport.mdx";
@@ -58,20 +60,24 @@ think through the transition process in your own context.
## Review and update communication policies
-<CommunicationPolicies />
-
-* In Zulip, it's easy to have many conversations in parallel without losing
- track of anything. Consider adjusting your communication guidelines to
- recommend having substantive discussions in channels, with less reliance on
- DMs.
-* Zulip allows users to fine-tune their notification settings. Make sure you're
- happy with the [defaults](/help/configure-default-new-user-settings) for your
- organization, and encourage users to adjust from there.
-* Zulip makes it easy to find conversations and follow up. To avoid disrupting
- focus work, @-mentions in Zulip should generally be reserved for
- time-sensitive messages. [Silent
- mentions](/help/mention-a-user-or-group#silently-mention-a-user) make it easy
- to refer to someone without calling for their attention.
+<CommunicationPoliciesIntro />
+
+<FlattenedList>
+ <CommunicationPoliciesList />
+
+ * In Zulip, it's easy to have many conversations in parallel without losing
+ track of anything. Consider adjusting your communication guidelines to
+ recommend having substantive discussions in channels, with less reliance on
+ DMs.
+ * Zulip allows users to fine-tune their notification settings. Make sure you're
+ happy with the [defaults](/help/configure-default-new-user-settings) for your
+ organization, and encourage users to adjust from there.
+ * Zulip makes it easy to find conversations and follow up. To avoid disrupting
+ focus work, @-mentions in Zulip should generally be reserved for
+ time-sensitive messages. [Silent
+ mentions](/help/mention-a-user-or-group#silently-mention-a-user) make it easy
+ to refer to someone without calling for their attention.
+</FlattenedList>
## Prepare users for the transition
diff --git a/starlight_help/src/content/docs/moving-to-zulip.mdx b/starlight_help/src/content/docs/moving-to-zulip.mdx
index a190cb85a81..ff605411d7f 100644
--- a/starlight_help/src/content/docs/moving-to-zulip.mdx
+++ b/starlight_help/src/content/docs/moving-to-zulip.mdx
@@ -7,7 +7,8 @@ import {Steps, TabItem, Tabs} from "@astrojs/starlight/components";
import FlattenedSteps from "../../components/FlattenedSteps.astro";
import ZulipNote from "../../components/ZulipNote.astro";
import ZulipTip from "../../components/ZulipTip.astro";
-import CommunicationPolicies from "../include/_CommunicationPolicies.mdx";
+import CommunicationPoliciesIntro from "../include/_CommunicationPoliciesIntro.mdx";
+import CommunicationPoliciesList from "../include/_CommunicationPoliciesList.mdx";
import ConfigureYourOrganization from "../include/_ConfigureYourOrganization.mdx";
import HowToInviteUsersToJoinImport from "../include/_HowToInviteUsersToJoinImport.mdx";
import HowToInviteUsersToJoinNoImport from "../include/_HowToInviteUsersToJoinNoImport.mdx";
@@ -108,7 +109,9 @@ Zulip.
## Review and update communication policies
-<CommunicationPolicies />
+<CommunicationPoliciesIntro />
+
+<CommunicationPoliciesList />
## Prepare users for the transition
diff --git a/starlight_help/src/content/docs/saml-authentication.mdx b/starlight_help/src/content/docs/saml-authentication.mdx
index a84e0a4c82c..9060339079a 100644
--- a/starlight_help/src/content/docs/saml-authentication.mdx
+++ b/starlight_help/src/content/docs/saml-authentication.mdx
@@ -4,6 +4,7 @@ title: SAML authentication
import {Steps, TabItem, Tabs} from "@astrojs/starlight/components";
+import FlattenedList from "../../components/FlattenedList.astro";
import FlattenedSteps from "../../components/FlattenedSteps.astro";
import ZulipTip from "../../components/ZulipTip.astro";
import AdminOnly from "../include/_AdminOnly.mdx";
@@ -54,12 +55,16 @@ providers.
1. Assign the appropriate accounts in the **Assignments** tab. These are the users
that will be able to log in to your Zulip organization.
1. <SendUsInfo />
- * Your organization's URL
- * The **Identity Provider metadata** provided by Okta for the application.
- To get the data, click the **View SAML setup instructions button** in
- the right sidebar in the **Sign on** tab.
- Copy the IdP metadata shown at the bottom of the page.
- <SamlLoginButton />
+
+ <FlattenedList>
+ * Your organization's URL
+ * The **Identity Provider metadata** provided by Okta for the application.
+ To get the data, click the **View SAML setup instructions button** in
+ the right sidebar in the **Sign on** tab.
+ Copy the IdP metadata shown at the bottom of the page.
+
+ <SamlLoginButton />
+ </FlattenedList>
</FlattenedSteps>
</TabItem>
@@ -86,9 +91,13 @@ providers.
| last\_name | Last Name |
| username | Email |
1. <SendUsInfo />
- * Your organization's URL
- * The **issuer URL** from the **SSO** section. It contains required **Identity Provider** metadata.
- <SamlLoginButton />
+
+ <FlattenedList>
+ * Your organization's URL
+ * The **issuer URL** from the **SSO** section. It contains required **Identity Provider** metadata.
+
+ <SamlLoginButton />
+ </FlattenedList>
</FlattenedSteps>
</TabItem>
@@ -120,14 +129,18 @@ providers.
* **name**: `user.principalname`
* **Unique User Identifier**: `user.principalname`
1. <SendUsInfo />
- * Your organization's URL
- * From the **SAML Signing Certificate** section:
- * **App Federation Metadata Url**
- * Certificate downloaded from **Certificate (Base64)**
- * From the **Set up** section
- * **Login URL**
- * **Microsoft Entra Identifier**
- <SamlLoginButton />
+
+ <FlattenedList>
+ * Your organization's URL
+ * From the **SAML Signing Certificate** section:
+ * **App Federation Metadata Url**
+ * Certificate downloaded from **Certificate (Base64)**
+ * From the **Set up** section
+ * **Login URL**
+ * **Microsoft Entra Identifier**
+
+ <SamlLoginButton />
+ </FlattenedList>
</FlattenedSteps>
</TabItem>
@@ -161,9 +174,13 @@ providers.
* **SAML Attribute Name**: `email`
* **SAML Attribute Name Format**: `Basic`
1. <SendUsInfo />
- * Your organization's URL
- * The URL of your Keycloak realm.
- <SamlLoginButton />
+
+ <FlattenedList>
+ * Your organization's URL
+ * The URL of your Keycloak realm.
+
+ <SamlLoginButton />
+ </FlattenedList>
</FlattenedSteps>
<ZulipTip>
@@ -193,9 +210,13 @@ providers.
}
```
1. <SendUsInfo />
- * Your organization's URL
- * The **SAML Metadata URL** value mentioned above. It contains required **Identity Provider** metadata.
- <SamlLoginButton />
+
+ <FlattenedList>
+ * Your organization's URL
+ * The **SAML Metadata URL** value mentioned above. It contains required **Identity Provider** metadata.
+
+ <SamlLoginButton />
+ </FlattenedList>
</FlattenedSteps>
</TabItem>
</Tabs>
diff --git a/starlight_help/src/content/include/_CommunicationPoliciesIntro.mdx b/starlight_help/src/content/include/_CommunicationPoliciesIntro.mdx
new file mode 100644
index 00000000000..3cc56c314c8
--- /dev/null
+++ b/starlight_help/src/content/include/_CommunicationPoliciesIntro.mdx
@@ -0,0 +1,2 @@
+Consider updating your organization's communication policies and practices to
+take advantage of Zulip's organized conversations:
diff --git a/starlight_help/src/content/include/_CommunicationPolicies.mdx b/starlight_help/src/content/include/_CommunicationPoliciesList.mdx
similarity index 89%
rename from starlight_help/src/content/include/_CommunicationPolicies.mdx
rename to starlight_help/src/content/include/_CommunicationPoliciesList.mdx
index a90b27926ec..d0d2be827df 100644
--- a/starlight_help/src/content/include/_CommunicationPolicies.mdx
+++ b/starlight_help/src/content/include/_CommunicationPoliciesList.mdx
@@ -1,6 +1,3 @@
-Consider updating your organization's communication policies and practices to
-take advantage of Zulip's organized conversations:
-
* Many organizations find that with Zulip, there’s no longer a reason to use
email for internal communications. You get the organization of an email
[inbox](/help/inbox) together with all the features of a modern chat app,