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

Sidebar: auto shows links for headings hidden by vue #1131

Closed
1 task done
mattbrailsford opened this issue Dec 24, 2018 · 1 comment
Closed
1 task done

Sidebar: auto shows links for headings hidden by vue #1131

mattbrailsford opened this issue Dec 24, 2018 · 1 comment

Comments

@mattbrailsford
Copy link

  • I confirm that this is a issue rather than a question.

Bug report

When using sidebar:auto sidebar links will be generated automatically from the headings in the markdown, however, if those headings are inside a vuejs code block that hides the section (ie, it has a v-if attribute to hide the contents based on a variable) the auto links are created regardless so you end up with links on the sidebar for content that isn't rendered to the page.

Version

0.x

Steps to reproduce

Create a page with frontmatter sidebar:auto and content of

## Some Heading 1

<div v-if="somVar">

## Some heading 2

</div>

<script>
export default {
    data() {
        return { someVar: false }
    }
}
</script>

What is expected?

Sidebar shouldn't show links for content that is hidden by vuejs

What is actually happening?

Sidebar shows links for all headings in the page whether they are visible or not

Other relevant information

  • Your OS: Windows
  • Node.js version: 8.x
  • Browser version: Chrome latest
  • Is this a global or local install? Local
  • Which package manager did you use for the install? yarn
@ulivz
Copy link
Member

ulivz commented Dec 25, 2018

Sidebar shouldn't show links for content that is hidden by vuejs

Hope you haven known the differences between build time and runtime. in VuePress, all the headers are extracted at build time, while your Vue.js code are running at runtime.

If you want to show a header dynamically, I suggest you to write HTML directly, so it will not be extracted by the internal markdown parser.

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

No branches or pull requests

2 participants