Skip to content
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

[Enhancement] Ability to add mathematical formulas in features description #3075

Open
malekadrar opened this issue Mar 3, 2023 · 1 comment

Comments

@malekadrar
Copy link

malekadrar commented Mar 3, 2023

Right now I don't think that we can add mathematical formulas in features description. For example, it's not possible to get this:

image

The solution I found is very simple which I would like to share with you, using MathJax. To do so, I've add the following new file math.ftl under serenity-core\serenity-report-resources\src\main\resources\freemarker\libraries directory and here is his content:

   <!-- mathjax -->
  <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
  <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3.0.1/es5/tex-mml-chtml.js"></script>

And I only included it in the file requirements.ftl under serenity-core\serenity-report-resources\src\main\resources\freemarker directory like this:

    <#include "libraries/math.ftl">

and compiled the library.

After that it's possible to use the LaTeX language. For instance, to get the above result, here is the feature description:

    Feature: The zeros of a second-degree polynomial
    
    If \\(a \ne 0\\) and \\(\(b^2-4ac\) \ge 0\\), there are two solutions to \\(ax^2 + bx + c = 0\\) and they are \\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\\]
    
    **Euler formula**
    
    \\[
        \sum_{n=1}^{+\infty} \frac{1}{n^2} = \frac{\pi^2}{6}
    \\]

          Scenario: ...
                Given ...
                When ...
                Then ...

Of course it's possible to combine MathJax with the Markdown.

Originally posted by @malekadrar in #3070

@malekadrar malekadrar changed the title Right now I don't think that we can add mathematical formulas in features description. For example, it's not possible to get this: Ability to add mathematical formulas in features description Mar 3, 2023
@malekadrar malekadrar changed the title Ability to add mathematical formulas in features description [Enhancement] Ability to add mathematical formulas in features description Mar 3, 2023
@wakaleo
Copy link
Member

wakaleo commented Mar 18, 2023

Can you propose a PR for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants