json-schema-md-doc icon indicating copy to clipboard operation
json-schema-md-doc copied to clipboard

$ref links don't navigate

Open s4m0r4m4 opened this issue 4 years ago • 4 comments

the function refLink works fine for HTTP links, but for internal schema references it just makes the link the same as the reference, so you get a bunch of links to things like #/definitions/myDef. When used in a browser or in the VS Code markdown viewer extension, those links don't seem to lead to any defined element in the markup.

I'd like to volunteer to make the following updates:

  1. Put an HTML anchor id on each element under definitions (like <span id="/definitions/myDef"> myDef </span>)
  2. Make sure the hyperlinks point to that id

Reference: https://daveabrock.com/2018/03/04/using-anchor-links-in-markdown

s4m0r4m4 avatar Feb 02 '21 21:02 s4m0r4m4

I'm super busy with other projects right now. You're welcome to branch and get something working if you need it for yourself. I'll circle back to it and review in a few weeks. Sorry about that timeline.

Some things to note about any changes

  • the /docs directory is used to run https://brianwendt.github.io/json-schema-md-doc/ which is how most of the people are using the tool.
  • https://brianwendt.github.io/json-schema-md-doc/lib/JSONSchemaMarkdown.js must continue to be available for anyone using it like that.

Out of curiosity, if you don't mind answering, what are you using the project for?

BrianWendt avatar Feb 02 '21 22:02 BrianWendt

Thanks for the tips. I modified my existing PR to conform to your request here (putting the source JS file back under docs/lib). Please comment on the PR if there is anything else you would like changed. Once we have that PR merged in, I'll do this one, which should be super easy and quick for you to review.

s4m0r4m4 avatar Feb 03 '21 16:02 s4m0r4m4

@BrianWendt to answer your other question, I do software development at a large organization and we were looking to generate documentation from some JSON schemas for inclusion in a Confluence Wiki. Your project hit all the marks in terms of customizability, flexibility, and runtime. I've got a set of upgrades that I've been working out that I'd love to contribute if you're open to it.

s4m0r4m4 avatar Feb 03 '21 19:02 s4m0r4m4

This may be fixed. I need to do some more use case testing to figure out if it's working for all reasonable uses of $ref

BrianWendt avatar Mar 26 '22 06:03 BrianWendt