typst icon indicating copy to clipboard operation
typst copied to clipboard

Non Programmer Friendly | Alternative function evocation syntax

Open sirinath opened this issue 1 year ago • 6 comments

Description

If it possible to have an alternate function calling and composition scheme that makes the writing a document in typst akin to using a lightweight markup language with style sheets.

E.g.

  • Ceylon language has this syntax: https://web.archive.org/web/20221005155238/https://ceylon-lang.org/documentation/1.3/tour/named-arguments/
  • Kotlin and Groovy markup builders
  • F# https://github.com/giraffe-fsharp/Giraffe.ViewEngine#html-elements-and-attributes
  • Short codes in templating languages

This syntax the document structure and formatting can be defined functions and parameters with styling information without the scripting. The document will have a more declaratively or lightweight markup like feel.

I am not sure what the ideal syntax should be, but something along the above lines.

Use Case

Some who would need to create and maintain documentation are not technical people and would not know much about the scripting features.

This way people who are familiar with WYSIWYG editors will be able to migrate to this more smoothly. By declaring the document

  1. structure,
  2. layout and
  3. formatting and styling through pre-defined function without knowing the underlying plumbing.

So is it possible to enhance the programming and standard library so that much of the scripting can be hidden from the users.

sirinath avatar May 31 '23 09:05 sirinath

This is to make it more versertiles to be used as an Office replacement to be used in companies.

sirinath avatar Jun 02 '23 13:06 sirinath

I am all for making Typst as non-programmer friendly as possible, but the suggested syntaxes just seem different to me, not necessarily simpler. Could you expand a bit on this?

Typst:

#figure(
  image("tiger.jpg"),
  caption: [A tiger],
)

Ceylon (from your example list):

figure {
    body = image { path = "tiger.jpg" };
    caption = "A tiger";
};

HTML

<figure>
  <image src="tiger.jpg"/>
  <caption>A tiger</caption>
</figure>

laurmaedje avatar Jun 02 '23 13:06 laurmaedje

Also Scala has introduced a new syntax: https://www.scala-lang.org/blog/2023/05/30/scala-3.3.0-released.html

#{
figure:
  image: "tiger.jpg"
  caption: "A tiger"
}

Also

#{

let MyAlignment = align: center // or let MyAlignment = align: center, _

grid:
  columns: 1fr, 1fr
  MyAlignment:
    ""
    Therese Tungsten
    Artos Institute
    #{ link: "mailto:[email protected]" }
    ""
  MyAlignment:
    ""
    Dr. John Doe
    Artos Institute
    #{ link: "mailto:[email protected]" }
    ""

Nothing is concrete. Just some initial thoughts.

, is optional if there is a line break.

To escape " and ' add additional " and ' for the outer text.

If there are quotes in one line then the preceding whitespace is stripped

sirinath avatar Jun 02 '23 14:06 sirinath

What makes that simpler than Typst's syntax in your opinion?

Enivex avatar Jun 02 '23 15:06 Enivex

Well this need more thinking and discussion.

I am not saying what I mentioned is the best.

We have to get many alternatives and choose the best.

sirinath avatar Jun 02 '23 17:06 sirinath

Also we have to get extensive feedback from non programmers and those who are just good with office documents.

sirinath avatar Jun 02 '23 17:06 sirinath

We have to get many alternatives and choose the best.

but why?

The Typst syntax is, in my opinion, simple and concise. Maintaining multiple syntaxes sounds like a nightmare and would increase the complexity of the project and for new users alike.

If there are three ways to do the same thing, that would become a new "tabs vs spaces" debate. Especially for collaborative documents where everyone wants their preferred syntax.

I, as a user and programmer, am hoping that Typst will not add another syntax.

nachtjasmin avatar Jun 04 '23 10:06 nachtjasmin

I agree with @nachtjasmin and would thus close this.

laurmaedje avatar Aug 28 '23 20:08 laurmaedje

When using something like mark down, even non programmers can maintain and write these documents.

What I am saying here is not a choice between syntax A vs syntax B for programmers but making the syntax subtle or reducing the syntax so non programmers and non technical people can also write and maintain the documents. When the alternate syntax is fully tested out it can remain a syntactic sugar or the old syntax can be deprecated and removed.

This is to get to use Typst in a wider office context than just for technical and academic writing.

sirinath avatar Aug 29 '23 04:08 sirinath

If I put it in another way, if you ask someone just familiar with only Word, like a sectary or office assistant to try out Typst they will get easily over whelmed for any non trivial formatting. So what is needed is some form of further simplification to make Typst usable by such people.

sirinath avatar Aug 29 '23 04:08 sirinath

The thing is that the current syntax is the simplest I was able to come up with. Some parts of it could of course be simplified in isolation, but the challenging part is to simplify the syntax as a whole without making it inconsistent.

The current syntax is perhaps not the easiest to grasp at first glance, but I would say that it is quite consistent, which is also an important contributor to long-term simplicity.

All that is to say: There probably is a syntax that achieves all that the current one achieves and that is "simpler" (however you would measure that). Finding it though is very challenging and I have spent a long time coming up with the current one. If there are concrete proposals, I'm happy to discuss them, but a general "make it simpler" issue not really actionable.

laurmaedje avatar Aug 29 '23 08:08 laurmaedje