Replies: 4 comments 2 replies
-
That would be amazing. It looks daunting to me. Even though djot's grammar is simpler in some ways than commonmark's, it is still pretty complex from the point of view of TreeSitter; I think you'd still need separate phases for blocks and inlines, the way they do it TreeSitter grammars for markdown/commonmark. I haven't given thought to built-in support for indexing, but this should be something you could achieve using generic constructs and some filters (AST transformations). For example, you could use spans:
|
Beta Was this translation helpful? Give feedback.
-
I'm writing a visual editor for pandoc AST that adds support for indices, just using pandoc's flexibility, without the need of any new I'm using a Index terms must have an Index references are just empty So without any filter that converts those elements in a real index, in the output
Here's an example I made with the editor:
Here's a screenshot of the example above in the editor. Months ago I started writing a lua filter to export those indices in ICML. Sorry for not posting anything more than some vaporware (though I edited and typeset a real book with the editor and ConTeXt). |
Beta Was this translation helpful? Give feedback.
-
Simply to overcome a limitation of the editor, which is based on Prosemirror, the best kit I know to make a rich text editor in a browser. Prosemirror has a flattened, not tree-like, structure at paragraph level (see here), that simplifies the task of the editor. When you have a But that's about the internal coding of an index reference. What I actually do in the editor is this: I select a span of text -- say a person name for the index of names -- and then click on the names' index ref button (right in the toolbar in the image) Suppose I selected the word "Robert". The editor:
Here's the dialog to modify the attribute of the When you save the document and then reopen it, the editor looks at the If you edit it and change it to "Bob", the decoration would perhaps follow the editing, but you'll lose the match between the text you see and the It's possible to correct this in real time, but it would slow the editor. Index references are punctual in nature; also ranges are made of two punctual references, begin and end. |
Beta Was this translation helpful? Give feedback.
-
I added a proof of this concept to Djockey. Docs here: https://steveasleep.com/djockey/plugins/indexterms.html Plugin source: https://github.com/irskep/djockey/blob/main/src/plugins/indextermsPlugin.ts Would this potentially serve your needs? Djockey doesn't do PDF output yet, but I could prioritize it. |
Beta Was this translation helpful? Give feedback.
-
I'm starting to look at Djot for some technical content I have for my NNG open source project.
I have a rich reference manual for this, and I produce some nicely typeset printed editions, as well as EPUB and online HTML. Currently I'm using ASCIIDOC. I contributed to the libasciidoc golang project to try to improve it, but I've been very disillusioned with the ASCIIDOC projects failure to even start on a meaningful specification now several years after promising to start (and I volunteered to help.)
Anyway, to get to the point, one feature that I do rely upon, and find missing in Djot, is any support for indexterms, so that I can generate a printed index at the back of the document. For printed material, this is incredibly useful, at least for old school folks like me.
Has anyone given thought to this? It seems like this could be an specific kind of attribute reference I suppose, but we would need tooling to know how to grok this, and I'm probably not up to writing that portion of the code.
(On the other hand, as an author of several TreeSitter grammars, including probably the most complex TS grammar, the one for D, I might be able to knock out a TreeSitter grammar for djot, as if I switch to it I will surely want a grammar. ASCIIDOC is too badly specified and requires some very expensive stateful processing to make writing a TS grammar for it an easy effort -- although I've started one. I think having a clearly specified grammar, and one that is free of insanity, for djot will make this a vastly easier effort.)
Beta Was this translation helpful? Give feedback.
All reactions