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

Link to api title from toc #331

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/prmd/templates/table_of_contents.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<% _, schemata = schema.dereference(property) %>
- <a href="#resource-<%= resource %>"><%= schemata['title'].split(' - ', 2).last %></a>
<% schemata.fetch('links', []).each do |l| %>
- <a href="#link-<%= l['method'] %>-<%= resource %>-<%= l['href'] %>"><%= l['method'] %> <%= build_link_path(schema, l) %></a>
- <a href="#<%= schemata['title'].gsub(/\s/, '-').downcase %>-<%= l['title'].gsub(/\s/, '-').downcase %>"><%= l['method'] %> <%= build_link_path(schema, l) %></a>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion test/commands/render_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_render_for_toc

assert_match /^## The table of contents/, markdown
assert_match '<a href="#resource-app"', markdown
assert_match '- <a href="#link-POST-app-/apps">POST /apps', markdown
assert_match '- <a href="#app-create-app">POST /apps', markdown
assert_match '<a name="link-POST-app-/apps"', markdown
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this a name need to change to match the other name for the anchors to function?

end

Expand Down