Skip to content

Commit

Permalink
Pass text to hr render
Browse files Browse the repository at this point in the history
  • Loading branch information
yahtnif committed Jun 19, 2019
1 parent 295b5cb commit c4254e9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ footnote(footnotes)

heading(text, level, raw, ends)

hr()
hr(text)

html(html)

Expand Down
3 changes: 2 additions & 1 deletion src/block-lexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ export class BlockLexer {
if ((execArr = this.rules.hr.exec(nextPart))) {
nextPart = nextPart.substring(execArr[0].length)
this.tokens.push({
type: TokenType.hr
type: TokenType.hr,
text: execArr[0]
})
continue
}
Expand Down
2 changes: 1 addition & 1 deletion src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class Parser {
// return body
}
case TokenType.hr: {
return this.renderer.hr()
return this.renderer.hr(this.token.text)
}
case TokenType.html: {
// TODO parse inline content if parameter markdown=1
Expand Down
3 changes: 2 additions & 1 deletion src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ ${quote}</blockquote>
`
}

hr(): string {
hr(text?: string): string {
// NOTE text.length => <hr> style
return this.options.xhtml ? '<hr/>\n' : '<hr>\n'
}

Expand Down

0 comments on commit c4254e9

Please sign in to comment.