-
Notifications
You must be signed in to change notification settings - Fork 30
Add inline math filter #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @P-SiZK, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Qiita Markdown parser by adding a new inline math feature. It allows users to embed mathematical formulas directly within text using a clear Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for a new inline math format $<code>...</code>$
to the Qiita Markdown processor. This allows writing inline math without escaping characters, avoiding conflicts with standard Markdown syntax while preventing conflicts with existing block math format ($$
).
- Created
InlineMath
filter to detect and convert the new format - Integrated the filter into the processing pipeline
- Added comprehensive test coverage for various scenarios
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
lib/qiita/markdown/filters/inline_math.rb | New filter implementation that converts $<code>...</code>$ patterns to <span>$formula$</span> |
lib/qiita/markdown/processor.rb | Adds the InlineMath filter to the default filter pipeline |
lib/qiita/markdown.rb | Includes the new filter module in the main require statements |
spec/qiita/markdown/filters/inline_math_spec.rb | Test suite covering various inline math scenarios including edge cases |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new filter for inline math, which is a great addition. The implementation is on the right track. I've identified a couple of areas for improvement. The logic for detecting the $
delimiters could be more robust to handle edge cases like $$$
. I've suggested a way to fix this using a regular expression. I also noticed a small opportunity to refactor the code to avoid redundancy. Finally, I've recommended adding more test cases to cover these edge cases and ensure the filter is solid. Overall, good work!
356dd9f
to
aed13f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What
Add support for a new inline math syntax:
$`...`$
.This allows writing inline math without escaping, avoiding conflicts with Markdown syntax.
This new syntax follows the inline math syntax used on GitHub (reference) and GitLab (reference).
How
Qiita::Markdown::Filters::InlineMath
class$<code>...</code>$
patterns<code>
tags to<span>$formula$</span>
$$
(block math format)