Commit Graph

45 Commits

Author SHA1 Message Date
Shubham Padia
40f723c75a help-beta: Add MDX files to git.
We have not yet removed the help files. We can use this commit as a
conversion commit since a lot more help changes will be merged before
this PR gets merged. We will need to rebase on top of main, run
conversion step in this commit, push those changes and then merge the
PR.

NOTE: This commit temporarily breaks the astro build since we have
renamed the path in the MDX files from starlight_help/ to help/ early.
That should be fine since astro build will not break any tests right
now.
We should squash this commit with the next commit removing help center
files when merging into main and remove this NOTE.
2025-09-03 09:28:15 -07:00
Shubham Padia
3e60b16ac1 starlight_help: Move help-beta over to starlight_help.
We are starting the cutover process and starlight_help is the directory
we have agreed on to place our new help center project. We do not want
to use `starlight_help` as the URL for the project, but this commit
changes the url from `help-beta` to `starlight_help` temporarily since
we can only change URL once we get rid of the current help center
project. That will be done in a future commit.
2025-08-08 11:59:29 -07:00
Shubham Padia
5e9dec802e help-beta: Make loose ordered lists tight in the conversion tool.
We chose not to edit the original markdown files to make this change
since the conversion script logic can be used for removing these lines
with very little changes and we don't need the original markdown source
files to be edited before the cutover.

The css for making loose and ordered lists look same has been removed
since we wanted to to respect commonmark specification.
2025-08-06 10:44:04 -07:00
Shubham Padia
c6a0e79342 help-beta: Insert steps around ordered lists.
We remove the ol > li margin rule to space out ordered list items since
that was the result of us overriding an upstream margin rule in
steps.css.

We inserted Steps inside include files only if they are not entirely
composed of an ordered list. If they are, they will eventually be
wrapped inside FlattenedSteps and wrapping these macros with Steps will
not give us the results we desire.
2025-08-04 13:25:15 -07:00
Shubham Padia
502c8072b0 help-beta: Use steps component instead of using steps.css.
Using steps.css right now might feel like the more convenient way out,
but it might introduce friction in upgrades when the upstream code
changes. To tackle that, we convert FlattenList to FlattenedSteps and
explicitly use the steps component.
2025-08-04 13:25:15 -07:00
Shubham Padia
baa87f3f0c help-beta: Run format step in the conversion tool. 2025-08-04 09:55:18 -07:00
Lauryn Menard
624988d498 help-beta: Rename "identifier" to "target" in NavigationSteps. 2025-08-01 09:15:12 -07:00
Lauryn Menard
9a25e97c40 help-beta: Adjust icon class names in the conversion process.
Use the icon's name, in camelcase, with the suffix "Icon" for
icon class names in the new help center documentation. E.g.,
zulip-icon-external-link becomes ExternalLinkIcon and fa fa-plus
becomes PlusIcon.
2025-08-01 09:13:05 -07:00
Shubham Padia
49e7e9dae8 help-beta: Stop asides from making a tight list loose.
A lot of our admonition declaration had an empty new line in the
beginning which was getting ported over in the conversion. This caused
the asides to unintentionally mark a tight list as loose which we do not
want.
2025-07-30 11:05:15 -07:00
Shubham Padia
ecf3fd90c2 help-beta: Recursively traverse for get_include_files_info.
We do have cases of multi level includes that apply to
is_include_only_ordered_list.
2025-07-29 10:09:21 -07:00
Shubham Padia
8b9c616ea2 help-beta: Remove reduntant TODO item for ordered list numbering.
The TODO list item wanted us to check that all ordered list items
started with `1.`. We fixed this in #34964.
2025-07-29 10:09:21 -07:00
Shubham Padia
b19fbe5c9b help-beta: Remove redundant TODO item for indented admonitions.
This was fixed in 41846b35ab.
2025-07-29 10:09:21 -07:00
Shubham Padia
96bb7ffc05 help-beta: Includes with tips can also now be only ordered lists.
FlattenList was not able to handle other components inside a list in the
past, but that has changed in the past few commits and we no longer need
to check for tips in include files for `is_include_only_ordered_list`.
2025-07-29 10:09:21 -07:00
Shubham Padia
646558af13 help-beta: Check for nested ordered list for flatten list conversion.
We had some include files that started with another include, and in some
cases this nested included file was also `only` an ordered list. In that
case, we need to add a flattenlist around the file, but our current
conversion script was not accounting for that.
2025-07-29 10:09:21 -07:00
Shubham Padia
8d0f67c3d5 help-beta: Add support for converting {{ support_email }} variable.
Fixes
https://chat.zulip.org/#narrow/channel/19-documentation/topic/new.20help.20center.3A.20support.20email.20variable.20conversion

We already have this variable defined in astro.config.mjs. We just need
to convert it to appropriate syntax.
2025-07-29 10:04:40 -07:00
Shubham Padia
cb852b0fa6 help-beta: Add ZulipTip custom component that does not have a header.
We do not want to have a heading for every tip and thus we created a
custom component for our aside. We want to add a lightbulb icon and the
text `Tip:` is bold as a prefix for every tip as if it was already part
of the text. To do that, we cannot insert both of those as html seperate
from the slot html, we had to access the slot html and insert both of
them into the HTML tree.
2025-07-24 12:00:26 -07:00
Shubham Padia
41846b35ab help-beta: Convert indented admonitions to asides.
Fixes https://chat.zulip.org/#narrow/channel/19-documentation/topic/new.20help.20center.3A.20broken.20tip
After indenting asides properly, they became part of lists, so we had to
change Flattenlist to allow asides inside it and ignore comments.
2025-07-24 11:59:48 -07:00
Shubham Padia
6d93465f3b help-beta: Remove header from Zulip note.
We don't want to have a title of note and the ⓘ  icon in the note aside.
The only way to do this is to have our custom component called
ZulipNote.
2025-07-21 12:56:52 -07:00
Shubham Padia
8f51b93223 help-beta: Convert file includes that don't occupy their own lines.
The regex we were using for file includes was searching for the syntax
at the start of a line but the file includes can be followed by a `- `
as part of a list item, due to which 15 occurences of includes were not
being converted. This commit fixes that.
2025-07-21 12:56:52 -07:00
Shubham Padia
30ff98c2f6 help-beta: Function to insert flattened steps should run on includes.
We were not running this function on includes, for relative/settings
links and for nested includes, we need to flatten them in the includes
too.
2025-07-02 09:27:48 -07:00
Shubham Padia
b7fa1e6a3c help-beta: Only convert .md files.
Fixes https://chat.zulip.org/#narrow/channel/19-documentation/topic/build-help-center.20exceptions

We were getting an error during the conversion step if there was somehow
a non utf-8 file in /help. In the case that we encountered, it was most
likely .DS_Store created by MacOS.
2025-06-29 23:32:25 -07:00
Tim Abbott
ed2e9777c9 build-help-center: Don't fail the first time. 2025-06-26 11:24:31 -07:00
Shubham Padia
8d4c2b7847 help-beta: Add support for relative links.
Fixes #31253.
We've added another env variable called `SHOW_BILLING_HELP_LINKS`.
This env variable is set to `settings.CORPORATE_ENABLED` if the
`build-help-center` tool is used.
2025-06-26 10:53:53 -07:00
Shubham Padia
224b98b455 help-beta: Fix relative path during initial stages of conversion.
When we were doing it later, the issue we encountered was that when we
add support for relative links in the future, relative path fixing was
happening after `relative/help` had been added to the modified markdown
file, replacing it with `relative/help-beta` which wasn't the
replacement we intended.
2025-06-26 10:46:37 -07:00
Shubham Padia
a0deeae80e help-beta: Introduce NavigationSteps component for settings links.
Fixes #31254.
We are using `SHOW_RELATIVE_LINKS` as the env variable to set if we
want to show relative settings link or non-linked markdown instructions.
We are not trying to determine `SHOW_SETTINGS_LINK` by ourselves. See
https://chat.zulip.org/#narrow/channel/49-development-help/topic/Passing.20sitename.20for.20astro.20project.20in.20production.2E
for more details.
Until the cutover happens, we would need to manually update the mapping
in both the astro component and the python file, but since that mapping
is not frequently changed, that is a tradeoff we can make.
We had to add margin-bottom: 0 to icon styling since starlight was
inserting a margin-bottom of 1.25 em for list items.
2025-06-26 10:46:37 -07:00
Shubham Padia
1e50a98b01 help-beta: Add TODO list to keep track of items before cutover. 2025-06-23 09:48:43 -07:00
Shubham Padia
2977bf364e help-beta: Use FlattenList component instead of hacky middleware.
We want to follow the Astro way of doing things and the middleware was
adding more magic + it was violating commonmark spec:
https://spec.commonmark.org/0.31.2/#example-301.

We insert FlattenList component where include files are being
treated as part of ordered lists. Astro renders included files as it's
own component, which would result in multiple ordered lists instead of
a single list if we did not use this component. See the astro component
file itself to know more how FlattenedSteps works.

We are not inserting FlattenList component for files with !!! tip
components, since we need to do it inside the include file. There are 4
such files at the time of writing this comment.
`is_include_only_ordered_list` makes sure of that. We can do the
conversion for it manually during cutover or in a followup PR.

All unordered lists at the time of writing this comment are standalone
components and we do not need to do any transformation for them.

We also changed the order of conversion of include and main files.
Include files are now being converted first to calculate
include_files_info.

Relevant topic:
https://chat.zulip.org/#narrow/channel/19-documentation/topic/Stage.202.3A.20New.20syntax.20for.20imports
2025-06-20 16:18:16 -07:00
Shubham Padia
a80941a78d help-beta: Rename include files to use pascal case during conversion.
If the file names are in Pascal case in the first place, it will
decrease mental load for any editor to convert a kebab case name to
Pascal case name.
2025-05-30 14:53:05 -07:00
Shubham Padia
c6c7c61fee help-beta: Convert MD comments to MDX comments. 2025-05-30 14:52:15 -07:00
Shubham Padia
5bbb7ebd1a help-beta: Convert tabs syntax to equivalent MDX syntax.
Fixes #31248.
For cases with zero tabs in our current help center, we were using the
tab syntax just to put a border around the instructions without any tab
label. We do not want that border anymore since Tabs also don't have any
borders. So, we just remove the old tab syntax in that case during our
conversion.

We also move the admonition to asides conversion before the tabs syntax
conversion since the tabs conversion happening first was messing with
the asides conversion and was resulting into some missing closing tags.
We can modify things to work regardless of order, but doesn't seem worth
digging into for a conversion script.
2025-05-28 16:42:16 -07:00
Shubham Padia
a23d928662 help-beta: Indent the content inside Asides or KeyboardTip.
MDX files were getting harder to read without proper indentation.
2025-05-28 16:42:16 -07:00
Shubham Padia
078a27def2 help-beta: Convert admonitions to asides and KeyboardTip.
Fixes #31249.
We have converted `warn` to `note` since that was the translation that
remains most faithful to how we display `warn` admonitions in our
current help center implementation. See
https://chat.zulip.org/#narrow/channel/19-documentation/topic/Stage.202.3A.20New.20syntax.20for.20!!!tip.20in.20help-beta/near/2174415
for more details.

We've also duplicated code from Python-Markdown to represent how
admonitions worked there more accurately. Duplication should be fine
since this is a one-off script and Python-Markdown is not a project
that's gonna change drastically in the future.
2025-05-15 11:53:40 -07:00
Shubham Padia
dfc2a7d19a help-beta: Convert include files to mdx along with required conversion.
Earlier, we were just renaming the files in help/include and copying
them over. Which meant that none of the mdx features or any of the
components we add could be used there. We could also not support nested
imports which are a part of the help/include files.

We also set an explcit height and width of 1em for icons, since some odd
behaviour for icon height and width was noticed when writing this
commit. unplugin-icons sets height and width by itself. It was setting
the height to 1024 and 960 for some icons. It is better to set the
height explicitly.
2025-05-13 10:21:17 -07:00
Shubham Padia
b1bf937cad help-beta: Remove BASE_DIR from path.join for output_dir.
BASE_DIR is already part of output_dir. There is no need to specify it
once more.
2025-05-13 10:21:17 -07:00
Shubham Padia
130877615e help-beta: Use .insert to insert string at a particular line.
The previous logic could not handle adding the given string at the 1st
line. We also rename the function to accurately represent what it does,
insert_string_at_line.
2025-05-13 10:21:17 -07:00
Shubham Padia
bb7af6e5c1 help-beta: Refactor convert_string_to_mdx to handle file read as well.
In future, we intend to add a function that will read the include files
and do a conversion to mdx. That conversion will be different from the
conversion that we are doing right now for the main help files. That is
why we have extracted the markdown file reading logic to the
`get_markdown_string_from_file` and renamed `convert_string_to_mdx` to
`convert_help_center_file_to_mdx` to be more specific for help center
files.
2025-05-13 10:21:17 -07:00
Shubham Padia
0f85d6327d help-beta: Fix bug of not rendering font-awesome icons correctly.
In `replace_icons`, when replacing zulip icons, the original
`markdown_string` was being passed instead of the result from the
previous font-awesome icon replacement.
2025-05-13 10:21:17 -07:00
Shubham Padia
68ec074a84 help-beta: Add support for displaying zulip icons.
We're using unplugin-icons to do so.
2025-05-12 18:13:26 -07:00
Shubham Padia
c97cd1c5dd help-beta: Add support for displaying font-awesome icons.
In our app, we use the font-awesome stylesheet, add it to our webpack
bundle and use the appropriate class with the <i> tag.
Here. although for font-awesome, we can use the stylesheet to do the
same, we would need to use `webfonts-loader` for our custom icons.
In this astro project, we want to follow the Astro way, and
unplugin-icons fits better with the Astro way of doing things.
See this topic on the discussion on how we chose unplugin-icons:
https://chat.zulip.org/#narrow/channel/19-documentation/topic/Stage.202.3A.20Icons/near/2168842
2025-05-12 18:13:26 -07:00
Shubham Padia
b378e33136 help-beta: Make it easier to keep track of imports in conversion.
Before this, every function itself was responsible for adding it's own
imports. That is extra string manipulation which we had to think about
everytime we were adding new conversion function.
Now, we have an import statement set that the functions can modify, and
we have a function responsible for adding those imports. This makes it
easier in the future to add more conversion functions which might be
introducing imports.
2025-05-12 18:13:26 -07:00
Shubham Padia
b813d868a7 help-beta: Merge lists of same type adjacent to each other.
Fixes #31252.
One of our major use cases for file imports is to have bullet points as
partials to import at different places in the project. But when
importing the file with Astro, it creates its own lists. So we merge
lists together if they have nothing but whitespace between them.
There were some talks to use a component called FlattenList that would
flatten the list inside it, but that would also flatten lists that were
nested on purpose. This approach while feeling a bit hacky would not
flatten nested lists.
2025-04-15 13:55:09 -07:00
Shubham Padia
c0a2b2a31d help-beta: Convert our custom file import syntax to astro.
We use all these markdown files in `include` only to import them into
our main help markdown files. Most of these files are bulleted lists of
text. When importing these files, they might appear as an indented
sublist of an existing list. We plan to introduce mechanism to flatten
it in further commits.
2025-04-15 13:55:09 -07:00
Shubham Padia
496aa16f19 help-beta: Add component for emoticon translations table.
Fixes #31257.
2025-04-07 10:33:39 -07:00
Shubham Padia
d98446491d help-beta: Add support for images.
Partially fixes #31255. We'll need to copy images to src/ at the time of
cutover. See
https://chat.zulip.org/#narrow/stream/6-frontend/topic/Handling.20images.20in.20help.20center.20starlight.20migration.2E/near/1915130
for more details.

We've also copied over css relevant to markdown images, while making
some small changes to it so that it works better with existing
starlight styling.
2024-10-24 13:01:50 -07:00
Shubham Padia
dd9cfb5bdd tools: Add script to convert .md files to .mdx.
This is the tool that we will consistently use for our project to
migrate our help center to use starlight.
We're only doing string manipulation in this tool for now, we will
start to use existing markdown preprocessors whenever appropriate
as we start to add support for different components.
Running the tool again will overwrite the existing files.
2024-08-02 18:18:01 -07:00