racket / scribble

Other
194 stars 89 forks source link

Allow `math` to interpret content within `{}` as a (sub)superscript #412

Closed NoahStoryM closed 4 days ago

NoahStoryM commented 4 months ago

See #411.

sorawee commented 4 months ago

Please also add some tests in https://github.com/racket/scribble/blob/master/scribble-test/tests/scribble/docs/manual.scrbl

NoahStoryM commented 4 months ago

I don't know how to test in manual.scrbl that math interprets superscript and subscript correctly, maybe I should directly test that pregexp is correct?

sorawee commented 4 months ago

You can write some content using math in the Scribble file, and then render it to text (https://github.com/racket/scribble/blob/master/scribble-test/tests/scribble/docs/manual.txt) and see if that's the result that you expect. If so, save the change. This will become the expected result that the test runner will compare against.

NoahStoryM commented 1 month ago

I just realized that we can achieve similar functionality by defining functions:

(define ^ (compose superscript math))
(define _ (compose subscript math))

I'm not sure if this PR is necessary, feel free to close it.

sorawee commented 4 days ago

I will close the PR then, thanks.