Skip to content

Commit

Permalink
remove back ticks in markdown-path
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Long committed Apr 16, 2024
1 parent 667e3d5 commit 7b4af7b
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions entrypoint/entrypoint/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,25 @@ def to_markdown(vulns,
return markdown


def merge_cell(pkg: str):
def merge_cell(a_string: str):
"""
This function expects a string of data
that is intended to be placed in a markdown
table. The provided data may include multiple
elements in a string, such as multiple PURLs
separated with a semi-colon character ';'.
This function splits the provided string
so that multiple elements can fit in one
cell in a markdown table.
"""

# return early on empty string
if a_string == "":
return ""

# we may have multiple PURLs for a single CVE,
# so split purls into a list we can iterate on
original_list = pkg.split(";")
original_list = a_string.split(";")
seen = set()
unique_list = []

Expand All @@ -374,9 +389,13 @@ def merge_cell(pkg: str):

unique_formatted = []
for each in unique_list:
# make each element preformatted text,
# otherwise the markdown report renders
# with malformed characters on GitHub
each = f"`{each}`"
unique_formatted.append(each)

# separate multiple elements in cell with HTML break characters
merged_cell = '<br><br>'.join(unique_formatted)
return merged_cell

Expand Down

0 comments on commit 7b4af7b

Please sign in to comment.