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

Broken link and wrong text in some ToC entries #2456

Closed
1 of 7 tasks
cconrad opened this issue Feb 19, 2022 · 3 comments
Closed
1 of 7 tasks

Broken link and wrong text in some ToC entries #2456

cconrad opened this issue Feb 19, 2022 · 3 comments
Assignees
Labels
scope.publish Static site generation, sending note links and anything to do with publishing your notes. status.info-needed More information is needed from filer for issue to be actionable type.bug Something isn't working

Comments

@cconrad
Copy link

cconrad commented Feb 19, 2022

Please select the area your bug applies to. (Multiple selections are Possible. You can leave blank if you're not sure.)

  • Workspace. VSCode workspace, vaults, Intellisense/autocomplete, Dendron settings
  • Lookup. Dendron's Lookup Command
  • Views. Dendron Preview, Tree View, Side Panels in the UI
  • Schema. Dendron Schemas
  • Pod. Data import from / export to Dendron
  • Publish. External Site Publish
  • Markdown. Markdown features, such as syntax support and features

Describe the bug

I noticed that we have a heading in the Dendron FAQ with the text "What can I do with the root note?", where "root" is inline code. This renders correctly on the page, but the entry in the table of contents reads "What can I do with the note?" (text content within inline code is missing).

In addition, the ToC link is broken, I assume that different logic is used to generate the href attribute of the a element in the ToC than what is used to generate the id attribute of the h1 element in the main content.

This made me test some other weird/special cases, and while I was unable to generate broken links in other ways, I discovered that the characters "-" and "_" are not rendered in ToC entries either - see table below.

To Reproduce

Steps to reproduce the behavior:

  1. Insert the Markdown from the second column of the table below in a note.
  2. Publish the page.
  3. Compare the main content with the ToC entries.
Test name Markdown HTML in main content HTML in ToC (actual result) Expected result
Inline code # Test1 `inlinecode` End <h1 id="test1-inlinecode-end">Test1 <code>inlinecode</code> End</h1> <a href="#test1--end">Test1 End</a> <a href="#test1-inlinecode-end">Test1 inlinecode End</a>
Hyphen # Test2 - (hyphen) End <h1 id="test2---hyphen-end">Test2 - (hyphen) End</h1> <a href="#test2---hyphen-end">Test2 (hyphen) End</a> <a href="#test2---hyphen-end">Test2 - (hyphen) End</a>
Underscore # Test3 _ (underscore) End <h1 id="test3-_-underscore-end">Test3 _ (underscore) End</h1> <a href="#test3-_-underscore-end">Test3 (underscore) End</a> <a href="#test3-_-underscore-end">Test3 _ (underscore) End</a>

Expected behavior

See the expected result for each test case in the right-most column "Expected result" of the table above.

Screenshots

image

Desktop (please complete the following information)

  • Versions (all that apply to bug):
    • Dendron CLI: 0.82.0
@github-actions github-actions bot added scope.publish Static site generation, sending note links and anything to do with publishing your notes. status.triage-needed type.bug Something isn't working labels Feb 19, 2022
@SeriousBug
Copy link
Contributor

Thanks for the report! This is a bug in how the titles are generated in published sites, we'll make sure to fix this.

For Dendron team: The code in DendronTOC.tsx tries to reverse the anchor slugs to get the title text, but that's not a reversible process. We should instead add the full text of the header to the anchors when they are parsed (AnchorUtils.headerText), and use that in the frontend.

@SeriousBug
Copy link
Contributor

This should be fixed with Dendron 0.84! (To clarify, the code styling won't apply to the sidebar but the text won't be missing).

Please let us know if you are still having issues with this, otherwise the issue will close in a few days.

@SeriousBug SeriousBug added the status.info-needed More information is needed from filer for issue to be actionable label Mar 2, 2022
@no-response
Copy link

no-response bot commented Mar 5, 2022

This issue has been automatically closed because there has been no response to our request for more information from the original author. We don't have enough information to take action. Please reopen if the question from the maintainer has been answered and the issue is still valid.

@no-response no-response bot closed this as completed Mar 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope.publish Static site generation, sending note links and anything to do with publishing your notes. status.info-needed More information is needed from filer for issue to be actionable type.bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants