DocC for Math Equations.
DocC has great support for mulitmedia content. But I thought one feature left was Math Equations. Most math equations in DocC are still displayed with pictures.
It would be great if we have something like
@Equations(alignment: .leading ){
x = @Fraction{
-b + @Sqrt("3"){ b^2 - 4 ac }
} over: { 2 a };
.ln{y} = .int^{y-1}_{0} 1 / {x+1} dx;
A = @Matrix(delimiter: .curlyBrace) {
1, 2, .cdots, 10;
2, 2, .cdots, 10;
.vdots, .vdots, .ddots, .vdots;
10, 10, ..., 10;
}
}
for formatting math equation. we could have Directives for some special equation structures and .inft, .alpha which can be implemented as enums of special math symbols, as other than decimal numbers it's not so commonly used in equations and follows the intuition of using enum in swift programming language.
And for codes.
@Code(language: .swift) {
let x = -b + sqrt(b*b - 4*a*c) / 2
}
it's unnecessary but would bring a more consistent syntax.
As DocC's Directive are like Declarative Syntax in SwiftUI, can we include a DocC struct in SwiftUI that allows you to display a DocC Document.
Besides, @Rows, @Columns saves a lot for more advanced text formatting. I'm wondering if DocC would have greater use just than write documentation for swift. You know, markdown, LaTeX , are all great, one's simple, easy but incapable of advanced text formatting and the left are much powerful but harder, typst is better.
After written all these lines I have realized that what I'm looking for is kind of a typesetting system conforms to swift programming language' syntax. use @Directive for Content modification() for parameters, {} which allows your to write string without quotation marks., and maybe still allow string interpolation.