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

Add new keywords support to Doc::Highlighter #7054

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions spec/compiler/crystal/tools/doc/highlighter_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe "Crystal::Doc::Highlighter#highlight" do
as as? typeof for in with self super private asm
nil? abstract pointerof
protected uninitialized instance_sizeof
annotation verbatim
).each do |kw|
it_highlights kw, %(<span class="k">#{kw}</span>)
end
Expand Down
3 changes: 2 additions & 1 deletion src/compiler/crystal/tools/doc/highlighter.cr
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ module Crystal::Doc::Highlighter
:lib, :fun, :type, :struct, :union, :enum, :macro, :out, :require,
:case, :when, :select, :then, :of, :abstract, :rescue, :ensure, :is_a?,
:alias, :pointerof, :sizeof, :instance_sizeof, :as, :as?, :typeof, :for, :in,
:undef, :with, :self, :super, :private, :asm, :nil?, :protected, :uninitialized, "new"
:undef, :with, :self, :super, :private, :asm, :nil?, :protected, :uninitialized, "new",
:annotation, :verbatim
highlight token, "k", io
when :true, :false, :nil
highlight token, "n", io
Expand Down