Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conditiona markup in markdown #2809

Copy link
Copy link
Open
@daggerok

Description

@daggerok
Issue body actions

This is more question than feature request, but I didn't found how to workaround...

Basically I just need to render on hide some part of markdown document depends on how I would like to build it, for development we are adding additional info, while from production, that info must be removed... Can you please suggest me how easily to solve that problem with ViuePress?

Feature request

What problem does this feature solve?

Similar to for example Asciidoctor where we can use ifdef / enddef conditional directives...
Possibility to add markup (or hide it) directly in markdown files depends on some defined globaly conditions.
Like v-if and v-else directive but defined directy in markdown file

What does the proposed API look like?

# title

<MyConditionalComponent :condition="process.env.NODE_ENV === 'development'">

## development info

</MyConditionalComponent>

<MyConditionalComponent :condition="process.env.NODE_ENV === 'production'">

## production info

</MyConditionalComponent>

<!-- ...skipped -->

I kn ow, process.env is not available on vuepress markdown page, maybe we could somehow get conditional expression from .vuepress/enhanceApp.js?

How should this be implemented in your opinion?

I dont. know, maybe some html wrapping elemet with some class or data-property...

Are you willing to work on this yourself?

Yes, I do

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.