New command line formatting tool

31 views
Skip to first unread message

Oscar Levin

unread,
May 20, 2026, 2:33:57 PM (11 days ago) May 20
to PreTeXt development
The pretext-tools extension has a "format my source" feature that is mostly schema aware.  Now you can run this outside of vs-code.  Directions are available here:


Feedback welcome and encouraged.

Rob Beezer

unread,
May 21, 2026, 12:24:26 PM (10 days ago) May 21
to prete...@googlegroups.com
Thanks, Oscar, for putting this together. I'm going to see about integrating it
into the build script for the website. (The "annotated" examples need a
formatting sweep first off.)

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com <mailto:pretext-
> dev+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-
> dev/7c0bfc66-71ea-425b-bf34-ffd4bff89c59n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-dev/7c0bfc66-71ea-425b-bf34-
> ffd4bff89c59n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Rob Beezer

unread,
May 21, 2026, 7:54:06 PM (9 days ago) May 21
to prete...@googlegroups.com
Short note, out of time for today, more later.

Current versions of "annotated" sample article and sample book, at the website,
have been generated with source material formatted by Oscar's tool.

Details of the changes to the website build script are at

https://github.com/PreTeXtBook/PreTeXt-website/pull/8

Thanks, Oscar!

Rob

Andrew Scholer

unread,
May 22, 2026, 11:09:18 AM (9 days ago) May 22
to prete...@googlegroups.com
Nice! This does seem like a much better route for formatting source annotations.

There are some spots where content is de-indented needlessly:
        <statement>
          <p>
Read in an integer <c>n</c>. Print out a n by n square of asterisks.
          </p>
        </statement>

And some formatting issues for interactives and RS exercises (but I made issues for those).


To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/MTAwMDAxMy5iZWV6ZXI.1779407644%40pnsh.

Oscar Levin

unread,
May 25, 2026, 12:50:57 PM (6 days ago) May 25
to PreTeXt development
I just pushed out a major update to the formatting package, which now uses unified and xast to parse the document.  It fixes a lot of issues that were present with the old formatter and now includes a printWidth option to wrap create new lines after a fixed number of characters.  But warning, the formatter now includes a printWidth option that defaults to 80 characters.  So previously formatted content might come out different if you don't change the default (setting printWidth to 0 will give the old behavior).

Updated on npm and also in the vs-code extension.

Jason Siefken

unread,
May 25, 2026, 1:15:41 PM (6 days ago) May 25
to prete...@googlegroups.com
I wonder if a default width of 100 would be better for the modern era.
Reply all
Reply to author
Forward
0 new messages