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

docs(gen_help_html.lua): handle modeline and note nodes #28766

Merged
merged 1 commit into from
May 17, 2024

Conversation

wookayin
Copy link
Member

@wookayin wookayin commented May 16, 2024

#28755 (comment)

Problem:

'modeline' and 'note' are unhandled in the online HTML documentation.

Some (not all) modelines are parsed by the vimdoc parser as a node of
type 'modeline'.

Solution:

  • Ignore 'modeline' in HTML rendering.
  • Render 'note' text in boldface.

Remark:

  • Words like 'Deprecated' and 'Note' are parsed as 'note' rather than 'word'.
  • I checked that there are no other unhandled nodes in the generated HTML files.

Problem:

'modeline' and 'note' are unhandled in the online HTML documentation.

Some (not all) modelines are parsed by the vimdoc parser as a node of
type 'modeline'.

Solution:

- Ignore 'modeline' in HTML rendering.
- Render 'note' text in boldface.
@clason
Copy link
Member

clason commented May 16, 2024

If some modelines aren't parsed, please open an issue (or PR ;)) at neovim/tree-sitter-vimdoc.

@justinmk
Copy link
Member

Some (not all) modelines are parsed by the vimdoc parser as a node

does that mean we still need this hack:

-- modeline
-- Example: "vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:"
or line:find('^%s*vim?%:.*ft=help')
or line:find('^%s*vim?%:.*filetype=help')

@clason
Copy link
Member

clason commented May 16, 2024

Let's try without and see how it goes. Parsing modelines is now the vimdoc parser's responsibility; papering over any shortcomings would be counterproductive.

@wookayin
Copy link
Member Author

Yes, I agree that having a "proper" fix rather than a bandaid solution would be better: fixing the vimdoc parser to correctly handle all the modeline instances. I will take a look at the vimdoc parser.

@wookayin wookayin marked this pull request as draft May 17, 2024 00:09
@github-actions github-actions bot removed the request for review from clason May 17, 2024 00:09
@clason
Copy link
Member

clason commented May 17, 2024

@wookayin I meant this in the sense of "this PR is fine and can be merged as-is" -- it's still an improvement, and any improvement in the vimdoc parser will be picked up automatically.

@clason clason marked this pull request as ready for review May 17, 2024 06:17
@clason clason merged commit 878dcf1 into neovim:master May 17, 2024
42 checks passed
@github-actions github-actions bot requested review from clason and removed request for clason May 17, 2024 06:18
@clason
Copy link
Member

clason commented May 17, 2024

The legacy modeline hack can be removed in a follow-up PR.

@wookayin wookayin deleted the docs-handle branch May 17, 2024 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants