xc icon indicating copy to clipboard operation
xc copied to clipboard

Support markup languages other than markdown

Open waldyrious opened this issue 2 years ago • 3 comments

It would be nice if xc supported task definition documents in formats other than markdown — for example AsciiDoc, reStructuredText, and other lightweight markup formats.

Note: This is just speculative at this point, according to @joerdav's comment here:

at this point I think sticking to markdown and getting it working well with that format is where I want to work on for the time being.

waldyrious avatar Mar 10 '23 16:03 waldyrious

@joerdav I'd be inclined to get this working for org-mode, if you're open to the contribution.

I'm picturing it would work like this:

* Install deps

#+name: install-deps
#+begin_src bash
npm ci
#+end_src
* Build

#+name: build
#+begin_src bash :after install-deps
npm run build
#+end_src
* Test

#+name: test
#+begin_src bash :after build
npm test
#+end_src

Here you can see how GitHub renders the markup, hiding the dependency info. That's different, but typical for org-mode, where if you want things included in your rendered document you're supposed to say that explicitly. It has built in facilities for recording execution related data that doesn't get rendered, unlike Markdown.

Anyhow, if you're not interested I can do my own little project, but I've been messing with xc lately and thought I'd ask.

ryanprior avatar Jun 23 '25 04:06 ryanprior

Hey, supporting org-mode would be great! My main priorities would be that it works as similarly to the markdown implementation as possible.

I can see that your proposal uses some hidden fields to work, I would rather they be explicit, that way they provide value even for a user who has no idea what xc is!

I would expect an org mode xc block to look like the following:

* Tasks

** install-deps

#+BEGIN_SRC bash
npm ci
#+END_SRC


** build

Requires: install-deps

#+BEGIN_SRC bash
npm run build
#+END_SRC

** Test 

Requires: build

#+BEGIN_SRC bash
npm test
#+END_SRC

Tasks are defined 1 level lower than the Tasks header. "Attributes" are clear text. And the titles of tasks are the same ones used to invoke them.

Let me know if you have any disagreements and we can work from here :)

joerdav avatar Jun 23 '25 08:06 joerdav

Your proposal is much closer to how xc already works, while still working with org-mode, so that seems totally acceptable.

I spent a little time looking into this over the weekend. I think I may take an approach something like:

  • in the cmd, pass the file extension ("md", "org") when instantiating a parser
  • move much of what's in parser.go now into parse-md.go, create new parse-org.go, and leave parser.go with interfaces & functions for both supported cases
  • modify docs & user-facing strings to update references to "Markdown" to say "documentation" or "plain text" instead, unless they are specifically referring to Markdown
  • add some org-files to parser/testdata/ mirroring the existing Markdown files & add tests covering them

I'll post a WIP PR here when I get something basic working.

ryanprior avatar Jun 30 '25 03:06 ryanprior