Commit Graph

14 Commits

Author SHA1 Message Date
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