diff --git a/docfx_yaml/extension.py b/docfx_yaml/extension.py index 5bbb381e..5db16494 100644 --- a/docfx_yaml/extension.py +++ b/docfx_yaml/extension.py @@ -1234,7 +1234,7 @@ def parse_markdown_header(header_line, prev_line): if not header_line[header_line.index(h1_header_prefix)+2].isspace() and \ len(header_line) > 2: - return header_line.strip("#").strip() + return header_line[header_line.index(h1_header_prefix):].strip("#").strip() elif "=" in header_line: # Check if we're inspecting an empty or undefined lines. diff --git a/tests/markdown_example_header.md b/tests/markdown_example_header.md index 9a534ce3..58d22101 100644 --- a/tests/markdown_example_header.md +++ b/tests/markdown_example_header.md @@ -9,10 +9,7 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ---> - - -# Test header for a simple markdown file. +--> # Test header for a simple markdown file. ##Content header This is a simple line followed by an h2 header.