question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`href` is missing in the section heading

See original GitHub issue

Current behavior

There is no href for headings, and there are warnings:

Warning: Failed prop type: The prop `href` is marked as required in `SectionHeadingRenderer`, but its value is `undefined`.
<!-- the current output html for the heading -->
<h1 id="components" class="rsg--heading-14 rsg--heading1-15">
  <a class="rsg--sectionName-11">Components</a>
</h1>

To reproduce

mkdir no-heading-href-repro
cd no-heading-href-repro
yarn init -y
yarn add vue vue-loader vue-styleguidist vue-template-compiler webpack
echo '
const path = require("path");
const { VueLoaderPlugin } = require("vue-loader");
module.exports = {
  sections: [
    {
      name: "Components",
      components: path.resolve(__dirname, "./src/components/*.vue"),
    },
  ],
  webpackConfig: {
    module: { rules: [{ test: /\.vue$/, loader: "vue-loader" }] },
    plugins: [new VueLoaderPlugin()],
  },
};
' > styleguide.config.js
mkdir -p src/components
echo '
<template>
  <div>Foo</div>
</template>

<script>
export default {
  name: "Foo",
};
</script>
' > src/components/Foo.vue
yarn vue-styleguidist server --open

Expected behavior

There should be a href for the heading “Components”.

Environments

  • vue-styleguidist: 4.32.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
elevatebartcommented, Sep 16, 2020

I will definitely look into it.

0reactions
ikatyangcommented, Sep 16, 2020

Sorry I did not provide the actual usecase, I thought the minimal repro (for the href issue) should be enough, but it seems the minimal repro is not suitable for the case you mentioned above. Here’s the more appropriate repro modified from the initial repro:

 // styleguide.config.js
 const path = require("path");
 const { VueLoaderPlugin } = require("vue-loader");
 module.exports = {
   pagePerSection: true,
   sections: [
     {
       name: "Components",
+      sectionDepth: 1,
+      sections: [
+        {
+          name: "My Heading",
           components: path.resolve(__dirname, "./src/components/*.vue"),
+        },
+      ],
     },
   ],
   webpackConfig: {
     module: { rules: [{ test: /\.vue$/, loader: "vue-loader" }] },
     plugins: [new VueLoaderPlugin()],
   },
 };

If I click the “My Heading” in the sidebar, it’ll navigate to the “My Heading” section with url updated (http://localhost:6060/#/Components/My%20Heading). I thought clicking the section heading should behave the same as clicking the corresponding link in the sidebar, which brings us to the clicked section with the url updated, but the “My Heading” section heading is now a <span> instead of an <a>, is this behavior expected?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Heading level three not appearing as a hyperlink location.
When I try to hyperlink to the section from references within the document, only the top two layers of headings appear. I should...
Read more >
Word missing headings in insert hyperlink - Super User
I go to Insert > Link > Place in this document , but my headings didn't appear. (If I place a bookmark, then...
Read more >
Links in HTML documents - W3C
This section introduces the link (or hyperlink, or Web link), the basic hypertext construct. A link is a connection from one Web resource...
Read more >
<h1>–<h6>: The HTML Section Heading elements
The to HTML elements represent six levels of section headings. is the highest section level and is the lowest.
Read more >
Missing base href in header causes problems for relative file ...
I've experienced this with Bluemarine and another PHPTemplate theme. For instance, a node with URL http://example.com/node/3 rewrites relative filename of some.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found