Skip to content
Merged
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
7 changes: 4 additions & 3 deletions eng/pipelines/scripts/generate_overview_from_readme.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

# Use case: Given a README.md file, generate a readme_overview.html file and place it next
# Use case: Given a README.md file, generate a readme_overview.html file and place it next
# to the README.md. This will allow the javadocs jar step to append the contents of the
# readme onto the landing page.
#
#
# This script is necessary, instead of just invoking python markdown2 directly from the
# command line because the generated overview.html file needs to be enclosed inside of <body>
# tags. When the attach-javadocs runs with the overview option it will append it the contents
Expand All @@ -19,6 +19,7 @@
import markdown2
import os.path
from io import open
import re
import sys

def generate_overview(readme_file, version):
Expand All @@ -40,7 +41,7 @@ def generate_overview(readme_file, version):
# markdown2.markdown will create html from the readme.md file. The fenced-code-blocks
# extras being passed into the markdown call is necessary to deal with the embedded
# code blocks within the readme so they'll displaye correctly in the html
html_readme_content = markdown2.markdown(readme_content, extras=["fenced-code-blocks"])
html_readme_content = markdown2.markdown(re.sub(pattern='^(\s*)@', repl='\g<1>{@literal @}', string=readme_content, flags=re.MULTILINE), extras=["fenced-code-blocks"])

# Due to javadoc's iFrames the links need to target new tabs otherwise hilarity ensues
soup = BeautifulSoup(html_readme_content, "html.parser")
Expand Down