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

[Bug] Fix URL links in autogenerated security docs #3474

Merged
merged 21 commits into from
Feb 23, 2024

Conversation

terrancedejesus
Copy link
Contributor

@terrancedejesus terrancedejesus commented Feb 22, 2024

Summary

Security docs for prebuilt rule releases are currently generating links that do not pass tests upstream. We need to adjust accordingly in docs.py. More details to come.

Additional details

This PR introduces changes to doc.py which programmatically creates security rule AsciiDocs that are pushed as updates in a PR to elastic/security-docs.

Thread conversation with docs team for debugging

What was the issue?

  • Specifically for investigation_guide and setup, when generating the rule asciidoc, we would write these strings to the file as asciidoc codeblocks, with the source being markdown
  • This caused URLs to not only register, but be considered "broken" as they did not render properly, nor did the markdown formatting
  • Links were also in a markdown URL text link format and not asciidoc format, which are incompatible with asciidoctor checks

CI Job with broken links reference

NOTE: OSQuery code still appears in the final rule documentation and thus does not render into a hyperlink like it does in the Kibana UI.

Solution evidence

Bugs Fixed

  • Setup is added to the rule but was missing. This was completed in a previous PR.
  • All links in investigation guide or setup are now formatted in asciidoc and render properly, thus can be used by viewers
  • Solved "broken links" that were reported in the security-docs CI jobs that were from custom URL checks, not asciidoctor

Comparison from Preview Sites
Note that with these changes do remove markdown # headers and thus we loose the markdown header levels since we are converting these to asciidoc and making them bolded strings. The reason we do not attempt to convert them to asciidoc levels is because of the leveling sequential requirements noted here.

Suggested changes:
Screenshot 2024-02-23 at 4 01 54 PM

Existing:
Screenshot 2024-02-23 at 4 02 16 PM

@terrancedejesus terrancedejesus self-assigned this Feb 22, 2024
@terrancedejesus terrancedejesus added Area: DED documentation Improvements or additions to documentation python Internal python for the repository labels Feb 22, 2024
Copy link
Contributor

@eric-forte-elastic eric-forte-elastic left a comment

Choose a reason for hiding this comment

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

Great peer review! LGTM 👍

Copy link
Contributor

@Mikaayenson Mikaayenson left a comment

Choose a reason for hiding this comment

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

LGTM. Glad to see these bugs addressed at the same time. We'll revisit this all when we migrate all docs to the new site/ mdx format.

@terrancedejesus terrancedejesus merged commit 8e0ca42 into main Feb 23, 2024
14 checks passed
@terrancedejesus terrancedejesus deleted the bug-security-doc-generation-content branch February 23, 2024 21:50
protectionsmachine pushed a commit that referenced this pull request Feb 23, 2024
* added content() class method for guide and setup

* removed non-existent variable

* removed unnecessary newlines

* adjusted levels for titles

* reverting changes

* added method to convert markdown links to asciidoc

* adjusted regex to include trailing periods

* fixing linting errors

* adjusted regex pattern

* added content() class method for guide and setup

* stripped # out of investigation guide, setup or note

* adjusted formatting outcome

* changed function call

* fixed linting errors

* fixing auto-formatting for rule asciidoc

* fixing URL link removal

* fixing URL link removal

* removed strip() from string for setup

* fixed linting errors

* fixed linting errors

* adjusting code formatting for convert_markdown_to_asciidoc

(cherry picked from commit 8e0ca42)
protectionsmachine pushed a commit that referenced this pull request Feb 23, 2024
* added content() class method for guide and setup

* removed non-existent variable

* removed unnecessary newlines

* adjusted levels for titles

* reverting changes

* added method to convert markdown links to asciidoc

* adjusted regex to include trailing periods

* fixing linting errors

* adjusted regex pattern

* added content() class method for guide and setup

* stripped # out of investigation guide, setup or note

* adjusted formatting outcome

* changed function call

* fixed linting errors

* fixing auto-formatting for rule asciidoc

* fixing URL link removal

* fixing URL link removal

* removed strip() from string for setup

* fixed linting errors

* fixed linting errors

* adjusting code formatting for convert_markdown_to_asciidoc

(cherry picked from commit 8e0ca42)
protectionsmachine pushed a commit that referenced this pull request Feb 23, 2024
* added content() class method for guide and setup

* removed non-existent variable

* removed unnecessary newlines

* adjusted levels for titles

* reverting changes

* added method to convert markdown links to asciidoc

* adjusted regex to include trailing periods

* fixing linting errors

* adjusted regex pattern

* added content() class method for guide and setup

* stripped # out of investigation guide, setup or note

* adjusted formatting outcome

* changed function call

* fixed linting errors

* fixing auto-formatting for rule asciidoc

* fixing URL link removal

* fixing URL link removal

* removed strip() from string for setup

* fixed linting errors

* fixed linting errors

* adjusting code formatting for convert_markdown_to_asciidoc

(cherry picked from commit 8e0ca42)
protectionsmachine pushed a commit that referenced this pull request Feb 23, 2024
* added content() class method for guide and setup

* removed non-existent variable

* removed unnecessary newlines

* adjusted levels for titles

* reverting changes

* added method to convert markdown links to asciidoc

* adjusted regex to include trailing periods

* fixing linting errors

* adjusted regex pattern

* added content() class method for guide and setup

* stripped # out of investigation guide, setup or note

* adjusted formatting outcome

* changed function call

* fixed linting errors

* fixing auto-formatting for rule asciidoc

* fixing URL link removal

* fixing URL link removal

* removed strip() from string for setup

* fixed linting errors

* fixed linting errors

* adjusting code formatting for convert_markdown_to_asciidoc

(cherry picked from commit 8e0ca42)
protectionsmachine pushed a commit that referenced this pull request Feb 23, 2024
* added content() class method for guide and setup

* removed non-existent variable

* removed unnecessary newlines

* adjusted levels for titles

* reverting changes

* added method to convert markdown links to asciidoc

* adjusted regex to include trailing periods

* fixing linting errors

* adjusted regex pattern

* added content() class method for guide and setup

* stripped # out of investigation guide, setup or note

* adjusted formatting outcome

* changed function call

* fixed linting errors

* fixing auto-formatting for rule asciidoc

* fixing URL link removal

* fixing URL link removal

* removed strip() from string for setup

* fixed linting errors

* fixed linting errors

* adjusting code formatting for convert_markdown_to_asciidoc

(cherry picked from commit 8e0ca42)
protectionsmachine pushed a commit that referenced this pull request Feb 23, 2024
* added content() class method for guide and setup

* removed non-existent variable

* removed unnecessary newlines

* adjusted levels for titles

* reverting changes

* added method to convert markdown links to asciidoc

* adjusted regex to include trailing periods

* fixing linting errors

* adjusted regex pattern

* added content() class method for guide and setup

* stripped # out of investigation guide, setup or note

* adjusted formatting outcome

* changed function call

* fixed linting errors

* fixing auto-formatting for rule asciidoc

* fixing URL link removal

* fixing URL link removal

* removed strip() from string for setup

* fixed linting errors

* fixed linting errors

* adjusting code formatting for convert_markdown_to_asciidoc

(cherry picked from commit 8e0ca42)
protectionsmachine pushed a commit that referenced this pull request Feb 23, 2024
* added content() class method for guide and setup

* removed non-existent variable

* removed unnecessary newlines

* adjusted levels for titles

* reverting changes

* added method to convert markdown links to asciidoc

* adjusted regex to include trailing periods

* fixing linting errors

* adjusted regex pattern

* added content() class method for guide and setup

* stripped # out of investigation guide, setup or note

* adjusted formatting outcome

* changed function call

* fixed linting errors

* fixing auto-formatting for rule asciidoc

* fixing URL link removal

* fixing URL link removal

* removed strip() from string for setup

* fixed linting errors

* fixed linting errors

* adjusting code formatting for convert_markdown_to_asciidoc

(cherry picked from commit 8e0ca42)
protectionsmachine pushed a commit that referenced this pull request Feb 23, 2024
* added content() class method for guide and setup

* removed non-existent variable

* removed unnecessary newlines

* adjusted levels for titles

* reverting changes

* added method to convert markdown links to asciidoc

* adjusted regex to include trailing periods

* fixing linting errors

* adjusted regex pattern

* added content() class method for guide and setup

* stripped # out of investigation guide, setup or note

* adjusted formatting outcome

* changed function call

* fixed linting errors

* fixing auto-formatting for rule asciidoc

* fixing URL link removal

* fixing URL link removal

* removed strip() from string for setup

* fixed linting errors

* fixed linting errors

* adjusting code formatting for convert_markdown_to_asciidoc

(cherry picked from commit 8e0ca42)
protectionsmachine pushed a commit that referenced this pull request Feb 23, 2024
* added content() class method for guide and setup

* removed non-existent variable

* removed unnecessary newlines

* adjusted levels for titles

* reverting changes

* added method to convert markdown links to asciidoc

* adjusted regex to include trailing periods

* fixing linting errors

* adjusted regex pattern

* added content() class method for guide and setup

* stripped # out of investigation guide, setup or note

* adjusted formatting outcome

* changed function call

* fixed linting errors

* fixing auto-formatting for rule asciidoc

* fixing URL link removal

* fixing URL link removal

* removed strip() from string for setup

* fixed linting errors

* fixed linting errors

* adjusting code formatting for convert_markdown_to_asciidoc

(cherry picked from commit 8e0ca42)
protectionsmachine pushed a commit that referenced this pull request Feb 23, 2024
* added content() class method for guide and setup

* removed non-existent variable

* removed unnecessary newlines

* adjusted levels for titles

* reverting changes

* added method to convert markdown links to asciidoc

* adjusted regex to include trailing periods

* fixing linting errors

* adjusted regex pattern

* added content() class method for guide and setup

* stripped # out of investigation guide, setup or note

* adjusted formatting outcome

* changed function call

* fixed linting errors

* fixing auto-formatting for rule asciidoc

* fixing URL link removal

* fixing URL link removal

* removed strip() from string for setup

* fixed linting errors

* fixed linting errors

* adjusting code formatting for convert_markdown_to_asciidoc

(cherry picked from commit 8e0ca42)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport: auto documentation Improvements or additions to documentation python Internal python for the repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants