Skip to content

Conversation

@kbeyls
Copy link
Member

@kbeyls kbeyls commented Aug 20, 2025

This commit makes that work by changing how we indicate index entries in the main text.
So far, we used '\index{text_to_add_to_index}' in the main text, which is a latex-specific mechanism. To make this more format-neutral, this patch changes this to using spans of class "index" to indicate that some text needs to be added to the index. In this patch, it has the following features. More features can be added in later patches, if it shows they would be useful.

  • An index entry is added by putting the text that should be indexed in a span with class "index". It looks like this: ... An [exploit primitive]{.index} is a mechanism ... This will add "exploit primitive" to the index. Before this patch, this would be written as: ... An exploit primitive\index{exploit primitive} is a mechanism ...
  • When you want the entry in the index to be different from the text in the span, use the "entry" attribute on the span. For example: ... CFI schemes are sometimes classified as [coarse-grained]{.index entry="coarse-grained CFI"} or [fine-grained]{.index entry="fine-grained CFI"}. ...
  • If you want multi-level index entries, use the same character as in latex to indicate the different levels. For example: ... [cache invalidation]{.index entry="cache!invalidation"} ... will add a sub-entry "invalidation" under the main entry "cache" in the index.

This commit makes that work by changing how we indicate index entries in the
main text.
So far, we used '\index{_text_to_add_to_index_}' in the main text, which is a
latex-specific mechanism. To make this more format-neutral, this patch changes
this to using spans of class "index" to indicate that some text needs to be
added to the index. In this patch, it has the following features. More features
can be added in later patches, if it shows they would be useful.

- An index entry is added by putting the text that should be indexed in a span
  with class "index". It looks like this:
  ...
  An [exploit primitive]{.index} is a mechanism
  ...
  This will add "exploit primitive" to the index. Before this patch, this would
  be written as:
  ...
  An exploit primitive\index{exploit primitive} is a mechanism
  ...
- When you want the entry in the index to be different from the text in the span,
  use the "entry" attribute on the span. For example:
  ...
  CFI schemes are sometimes classified as [coarse-grained]{.index
  entry="coarse-grained CFI"} or [fine-grained]{.index entry="fine-grained
  CFI"}.
  ...
- If you want multi-level index entries, use the same character as in latex
  to indicate the different levels. For example:
  ...
  [cache invalidation]{.index entry="cache!invalidation"}
  ...
  will add a sub-entry "invalidation" under the main entry "cache" in the
  index.
@kbeyls
Copy link
Member Author

kbeyls commented Aug 20, 2025

This is a screenshot to show what the HTML-rendered index looks like with this patch:

Screenshot 2025-08-20 at 15 52 10

@kbeyls kbeyls linked an issue Aug 20, 2025 that may be closed by this pull request
@kbeyls
Copy link
Member Author

kbeyls commented Aug 20, 2025

closes: #90

@JLouisKaplan-Arm
Copy link
Collaborator

LGTM. If I had to add a nitpick question: do you think it would be easier visually to separate each index link with some punctuation, maybe a comma? But this patch is more than ready to go in as-is; approved.

@kbeyls
Copy link
Member Author

kbeyls commented Aug 21, 2025

LGTM. If I had to add a nitpick question: do you think it would be easier visually to separate each index link with some punctuation, maybe a comma? But this patch is more than ready to go in as-is; approved.

I quickly tried it out, and it looks like this with a comma:

Screenshot 2025-08-21 at 12 56 46

I think it does look better indeed, so I'll make that change as part of this PR before I merge it.
Thank you for the suggestion!

Copy link
Collaborator

@JLouisKaplan-Arm JLouisKaplan-Arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - that does look nice. Thanks!

@kbeyls kbeyls merged commit 81279c6 into llsoftsec:main Aug 21, 2025
2 checks passed
@kbeyls kbeyls deleted the indexing branch August 21, 2025 11:28
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

Successfully merging this pull request may close these issues.

2 participants