Skip to content

Commit

Permalink
Allow more characters in header IDs
Browse files Browse the repository at this point in the history
The current version only allows characters as defined by HTML4. However,
HTML5 allows any characters to be in an ID. Since allowing any character
might not play well with the XML syntax of HTML5, extend the allowed
character set to the full set allowed by XML.
  • Loading branch information
gettalong committed May 3, 2020
1 parent a7f2f5f commit 90954bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/kramdown/parser/kramdown/header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#

require 'kramdown/parser/kramdown/block_boundary'
require 'rexml/xmltokens'

module Kramdown
module Parser
Expand Down Expand Up @@ -40,7 +41,7 @@ def parse_atx_header

protected

HEADER_ID = /[\t ]{#(?<id>[A-Za-z][\w:-]*)}\z/
HEADER_ID = /[\t ]{#(?<id>#{REXML::XMLTokens::NAME_START_CHAR}#{REXML::XMLTokens::NAME_CHAR}*)}\z/

# Returns header text and optional ID.
def parse_header_contents
Expand Down

0 comments on commit 90954bc

Please sign in to comment.