Skip to content

Commit

Permalink
fix: update markdown header parser (#177)
Browse files Browse the repository at this point in the history
* fix: update markdown header parser

* test: update unit test
  • Loading branch information
dandhlee committed Feb 7, 2022
1 parent d7e1613 commit 71d50cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docfx_yaml/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 1 addition & 4 deletions tests/markdown_example_header.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 71d50cc

Please sign in to comment.