feat: custom KaTeX macro
#9779
Merged
thatonecalculator
merged 19 commits from naskya/calckey:feat/katex-macro
into develop
2 months ago
Reviewers
Request review
No reviewers
Labels
Clear labels
A bug whose causes are unknown
Issues and PRs about improving accessibility
The Antennas feature
The Channels feature
The Chat feature
The Clips feature
Issues about user or admin settings
Pull requests that update a dependency file
PRs and Issues relating to docker
The Drive feature
The Galleries feature
The Groups feature
Internationalization (i18n) related issue/PR
Pull requests that update Javascript code
Issues and PRs relating to Kubernetes
The Lists/Circles feature
Issues about using Calckey with a mobile device
Issues about notifications
Issues about posts, timelines, threads
The Widgets feature
This PR edits locales other than the ja-JP one. See locales/README.md
This change breaks compatibility
This issue/PR already exists
Server side specific issue/PR
This might be a bug
This adds/improves/enhances a feature
Interface between server and client
Unexpected behavior
Being discussed or needs discussion
Documentation related issue/PR
The Federation feature
Not based on facts / Outside the scope of Calckey
The Misskey Flavored Markdown feature
This needs test code
The Pages feature
Efficiency related issue/PR
Rewriting code without changing behavior
The Room feature
Security related issue/PR
SW related issue/PR
Test related issue/PR
This is a work in progress
This will not be worked on
Issues/PRs related to AiScript
Client side specific issue/PR
Development of Calckey itself
This needs extra attention
Apply labels
1️⃣ Good First Issue
❓needs more investigation
A bug whose causes are unknown
Accessibility
Issues and PRs about improving accessibility
Antennas
The Antennas feature
Channels
The Channels feature
Chat
The Chat feature
Clips
The Clips feature
CP/Settings
Issues about user or admin settings
dependencies
Pull requests that update a dependency file
Docker
PRs and Issues relating to docker
Drive
The Drive feature
Galleries
The Galleries feature
Groups
The Groups feature
i18n
Internationalization (i18n) related issue/PR
javascript
Pull requests that update Javascript code
Kubernetes
Issues and PRs relating to Kubernetes
Lists/Circles
The Lists/Circles feature
Mobile
Issues about using Calckey with a mobile device
Notifications
Issues about notifications
Posts/timelines
Issues about posts, timelines, threads
Widgets
The Widgets feature
‼️ wrong locales
This PR edits locales other than the ja-JP one. See locales/README.md
☢️Breaking
This change breaks compatibility
♻️Duplicate
This issue/PR already exists
⚙️Server
Server side specific issue/PR
⚠️bug?
This might be a bug
✨Feature
This adds/improves/enhances a feature
🧩API
Interface between server and client
🐛Bug
Unexpected behavior
💬Discussion
Being discussed or needs discussion
📖Doc
Documentation related issue/PR
🌌Federation
The Federation feature
💴has reward
🔥high priority
🚫Invalid
Not based on facts / Outside the scope of Calckey
🙏low priority
🖍MFM
The Misskey Flavored Markdown feature
🧪needs test
This needs test code
📜Pages
The Pages feature
🐢Performance
Efficiency related issue/PR
💚Refactor
Rewriting code without changing behavior
🏠Room
The Room feature
🔒Security
Security related issue/PR
🤖Service Worker
SW related issue/PR
🧪Test
Test related issue/PR
🚧WIP
This is a work in progress
🗿Wontfix
This will not be worked on
👩💻AiScript
Issues/PRs related to AiScript
🖥️Client
Client side specific issue/PR
🛠️Dev
Development of Calckey itself
🏳️needs help
This needs extra attention
No Label
1️⃣ Good First Issue
❓needs more investigation
Accessibility
Antennas
Channels
Chat
Clips
CP/Settings
dependencies
Docker
Drive
Galleries
Groups
i18n
javascript
Kubernetes
Lists/Circles
Mobile
Notifications
Posts/timelines
Widgets
‼️ wrong locales
☢️Breaking
♻️Duplicate
⚙️Server
⚠️bug?
✨Feature
🧩API
🐛Bug
💬Discussion
📖Doc
🌌Federation
💴has reward
🔥high priority
🚫Invalid
🙏low priority
🖍MFM
🧪needs test
📜Pages
🐢Performance
💚Refactor
🏠Room
🔒Security
🤖Service Worker
🧪Test
🚧WIP
🗿Wontfix
👩💻AiScript
🖥️Client
🛠️Dev
🏳️needs help
Milestone
Set milestone
Clear milestone
No items
No Milestone
Projects
Set Project
Clear projects
No project
Assignees
Assign users
Clear assignees
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.
No due date set.
Dependencies
No dependencies set.
Reference: calckey/calckey#9779
Reference in New Issue
There is no content yet.
Delete Branch 'naskya/calckey:feat/katex-macro'
Deleting a branch is permanent. It CANNOT be undone. Continue?
No
Yes
Closes: #9759
As I wrote in the Matrix chat room, I implemented this by creating
preprocess.ts
. I said that I wanted to add dependencies, but I could avoid that. So the dependencies are unchanged.a909cacb5b
@ -940,2 +940,4 @@
defaultReaction: "Default emoji reaction for outgoing and incoming posts"
license: "License"
customKaTeXMacro: "Custom KaTeX Macro"
customKaTeXMacroDescription: "Set up macros to write mathematical expressions easily! The notation conforms to the LaTeX command definitions and is written as \\newcommand{\\name}{content} or \\newcommand{\\name}[number of arguments]{content}. For example, \\newcommand{\\add}[2]{#1 + #2} will expand \\add{3}{foo} to 3 + foo. The curly brackets surrounding the macro name can be changed to round or square brackets. This affects the brackets used for arguments. One (and only one) macro can be defined per line, and you can't break the line in the middle of the definition. Invalid lines are simply ignored. Only simple string substitution functions are supported; advanced syntax, such as conditional branching, cannot be used here."
I don't think fluff like "Set up macros to write mathematical expressions easily!" is needed, the description should only be a sentence or two long and briefly explain what it does rather than giving a long paragraph.
TBH I think I like it this way. The first sentence describes the function, which is useful because if I just saw "Custom Katex Macro" in my Settings I would have no idea what it is, except if I cared enough to google it. Describing what it does informs the user if it's something useful to them or not. By nature, this feature needs a good explanation, otherwise you won't understand how it works. So I think that cutting it down to 1-2 sentences would just leave useful info outside - I think that even the example helps explain how the feature works. I think it won't bother anyone, it's just a paragraph and it's inside the page - you don't need to see or read it if you don't open the relevant Katex macro settings page.
I wrote the description with the same idea as @panos, but I also understand that the huge info box doesn't look very good. I wonder what I should do...
I don't think I can shorten the description very much. Yes, some adverbs/adjectives are unnecessary, the first sentence and the example could be removed, and good English writers can rewrite the sentence more concisely (I'm very bad at this), but that's all. The other information I included is strictly necessary, as I only implemented the function indicated by the red arrow.
If the description doesn't show what's available clearly, users may think that some macro doesn't work a bug and send bug reports, which I want to avoid.
182e4206a0
to99a0c192be
2 months ago9489543180
into develop 2 months ago9489543180
.Step 1:
From your project repository, check out a new branch and test the changes.Step 2:
Merge the changes and update on Forgejo.