Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the issue where nil for header_ids #324

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

ppworks
Copy link
Contributor

@ppworks ppworks commented Nov 27, 2024

Summary

I have fixed the issue where specifying nil for :header_ids in the :extension config would result in the nil option being cleared when reusing the config.

Target Version

https://github.com/gjtorikian/commonmarker/tree/v2.0.0/ext/commonmarker

Use Case

user_config = {
  extension: {
    header_ids: nil,
  },
}

text = "# Heading-1"

doc = Commonmarker.parse(text, options: user_config) # In this process, header_ids is nil, so it gets removed. 
doc.walk do |node|
  # do something
end

puts doc.to_html(options: user_config)

Expected Output

<h1>Heading-1</h1>

Actual Output in

<h1><a href=\"#heading-1\" aria-hidden=\"true\" class=\"anchor\" id=\"heading-1\"></a>Heading-1</h1>

@gjtorikian
Copy link
Owner

Thank you! ✨

@gjtorikian gjtorikian merged commit 3abd9b7 into gjtorikian:main Nov 27, 2024
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants