-
Notifications
You must be signed in to change notification settings - Fork 117
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
Linter/Formatter for Org documentation #307
Comments
Small update on this. However, while thinking about it more, I found there are a few more granular lint rules that really should be in there. These are the rules I came up with, some of these are opinionated (suggestions welcome). Section-based
Edit/For discussion: Line-basedGeneral
For discussion: Blocks (
|
Good ideas. I'll have a think on them, most I agree with, the only one I hesitate on is |
well, nobody has to use I think rephrasing it like "If you want your paragraphs/subheadings to be indented, use org-indent-mode instead of manually managing whitespace." However I'm obviously open to instead have a default indentation for sections (or something like that). |
I'm not against using it, but I don't know anything about it, since I don't use it. I'll look into it. I do like the idea of a standard indent and if the module makes that easy then we should definitely investigate it. |
Okay, I've put more thought into this, read some docs, tried a few
I like the idea of fixing things when we can detect them and do
Opinions welcome ☺
Yes to all. Questions
Yep. I'm all for whitespace cleanup. There is even a built-in
Agree.
Yes!! Absolutely!
Agree. |
Thanks for the lengthy feedback. Section-based
I originally was going to say "no nested lists" (when I started implementing the prototype), Lists get interpreted similarly to the headings when exporting, so I figured these should be limited in some capacity (although same applies for headings).
See above, but 3 seems good, the modules should be 2 as they are already under a heading in the main So I'd say total 4 levels of nesting, maximum 3 headings deep (I'll do more testing on that as I (re)implement rules etc.). leading-whitespaceThe reasoning for replacing leading whitespace with org-indent-mode for me was:
Obviously I am not locked into using I think adding org-indent-mode automatically for file-local editing might be a compromise, however I'm open for abandoning the line-too-long80 characters/columns is quite nice I find, especially helps when reading (apparently many things are laid out even tighter with 60 columns for readability, but 80 seems like a reasonable middle-ground). Attribute duplicatesThe duplicate seems ... very unlikely. I was mainly inspired by code linting tools (which often have some code duplication detection). I don't think there is necessarily a need for it and org shouldn't care about it either when exporting (although I haven't tested that). Attribute capsAs for no-caps on attribute, that was more a rule I put in for any form of consistency that already matched up with what I agree that using caps makes them stand out from the text (and attribute vals) more, so I think enforcing caps might be a good way to go. I updated some of the post above to show more alternative options for discussion. |
So ... small update as I've made new discoveries. Turns out I won't need to parse the org file myself because there is Additionally, turns out it's part of I see two potential paths from here:
The obvious choice would be option 2 ("more" built-in, probably less code).
As one can probably read from my points, I would prefer to roll a more custom solution, but I think this is a good point for discussion. |
I think you should do what makes you happiest. I would be interested in the flymake/flycheck integration, that would be super cool. I'm not as concerned about multi-pass as a solution, that does raise some concerns about conflicting rules, but as long as we can avoid those that should be low risk. In theory, we are running the linter "once in a while", like as part of the exporter or just before it, maybe in a make file or something. Obviously, a flymake/flycheck integration would run it more frequently, but could be prioritized during idle time (in theory). All that said, faster and more efficient is always better, even when it doesn't seem to matter. (Another example of this would be Emacs startup time, we'd prefer to minimize that as much as possible, even in the face of common usage patterns where either Emacs is started and runs for days, or using Emacs in server mode to accomplish the same result). |
More of a "tracking/WIP" issue, @jeffbowman mentioned in #166 the idea of building a linter/formatter for the documentation to enforce a style guide.
Had some time today, so I hacked together a small line-based regex-parser with a small linter (a bit under 300 lines of elisp).
Example output (popup buffer):
The core needs a rewrite, but the concept is there.
As for formatting, I'm still debating whether to make it a separate function or to replace the compile-buffer-like output with it acting on the buffer.
Just putting this up as an issue for now, ideas and suggestions welcome.
The text was updated successfully, but these errors were encountered: