Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed width areas elements #26

Open
gzagatti opened this issue May 30, 2022 · 1 comment
Open

Fixed width areas elements #26

gzagatti opened this issue May 30, 2022 · 1 comment

Comments

@gzagatti
Copy link

I have noticed that the grammar implemented here does not support "Fixed width areas" elements which basically are paragraphs that start with the colon character followed by space.

These elements are usually used to denote code evaluation output. For instance:

#+begin_src python
1 + 1
#+end_src

#+results: 
: 2

Is this a deliberate choice? It would be nice to have such support.

@milisims
Copy link
Owner

Great question, I think the best implementation here would use a query to find those elements, for example:
(paragraph (directive name: (_) @name (#eq? @name "results")) . (expr) @start (#eq? @start ":")) @results_region, is a query that should find elements that look like that (I can't test at this moment), but doesn't guarantee each subsequent newline starts with a :. Depending on the tree-sitter implementation used, a #match? predicate should be used to ignore case on "results".

I'm not eager to, but not against adding fixed-width areas. I'll look into it for a bit, thanks for the suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants