Add parseorg module#143
Conversation
285e22b to
ec4b117
Compare
|
@joerdav this is ready for review 🧾 😄 |
|
This looks great, sorry it took some time for me to get to! I wonder if some mention of this in the docs might be helpful? Maybe a separate page that just outlines the differences. |
|
@joerdav no worries, lots going on in the world! I was just gathering some CI thoughts yesterday, so this is a good season to return to thinking about |
* README.md: Updated to include references to org-mode in addition to Markdown * New file: ABOUT.org Introduces using xc with org-mode and describes org-specific features
|
Awesome, that's useful. My initial comment was around the documentation website that is generated from https://github.com/joerdav/xc/tree/main/doc and deployed to xcfile.dev I think this is the best place for this stuff to live! Thanks |
- Updates timestamp to ISO standard (`hugo` was complaining) - Links to org-mode feature explanation to doc website instead of on GitHub - Removes ABOUT.org
|
@joerdav I made a stab at updating the docs website. I viewed the it locally using |
|
Great, I think this is ready now, thanks! |
Hi there! Here's an org-parser in pursuit of #66.
Why?
In order to support org-mode with minimal refactoring, I decided to copy the Markdown parser & make minimal changes to it to make it work. I also copied the test suite and made minimal changes there.
What does this PR contain?
parseorg), following the pattern from Markdown.mdvs.org)-type {md,org}) to select a parser explicitly (overriding file suffix, if any)xcsearches for eitherREADME.mdandREADME.orgin current directory & parents (with preference forREADME.md, if both exist, to minimize potential for breaking change; though breakage is still possible, given that the tool would currently skip over a directory containingREADME.organd find a parent containingREADME.md, but would stop earlier after this change)What's next?
I have tested it thus far by running
go test ./...and by running it on various of my own org and md files. It could use some more testing.At this stage I welcome feedback on any aspect of the approach, code organization, testing, etc. If you are worried about code duplication, I was thinking about doing another pass after getting the thing working to deduplicate and refactor the parsers somewhat. The approach I've favored has the benefit of minimizing code changes for Markdown users, reducing the potential to break the current behavior.
Notes on differences from md behavior
These are documented for end-users in
ABOUT.orgorg-mode supports comment headings, which begin with
COMMENTand are intended to be skipped over during execution. I've added some logic to honor this for headings that would otherwise be counted as task headings (see example here, and notice that in the rendered view GitHub correctly skips rendering that heading.)org-mode has an explicit affordance for hidden markers attached to headlines: tags. I decided to look for a
:xc_heading:tag on a heading rather than an HTML comment. Here's what it would look like in practice: