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

Highlight code block at runtime #676

Closed
faustbrian opened this issue Jul 28, 2018 · 3 comments
Closed

Highlight code block at runtime #676

faustbrian opened this issue Jul 28, 2018 · 3 comments
Labels
type: feature request Request to add a new feature version: next Planned to do or already included in the next(1.0.0) version

Comments

@faustbrian
Copy link

faustbrian commented Jul 28, 2018

I am currently trying to figure out if there is some way to render a code block at runtime. What I am trying to achieve is to create a highlighted JSON code block based on a response I receive from a request.

<template>
    <div>
        <div ref="request">
            <slot></slot>
        </div>

        <button @click="sendRequest">Something</button>
        
        <div ref="response">
// response here once the request is done
       </div>
    </div>
</template>

<script type="text/javascript">
    export default {
        methods: {
            sendRequest() {
                request(options).then(data => {
                    // show JSON.stringify(data) in this.$refs.response as highlighted JSON
                }).catch(err => {
                    // do nothing...
                })
            }
        }
    }
</script>

Is there any way to achieve this? Tried a few things and looked for a component but assume that markdown-it does the rendering for the normal templates.

@ulivz
Copy link
Member

ulivz commented Jul 28, 2018

#413 (comment)

@ulivz ulivz added plugin scope type: feature request Request to add a new feature labels Jul 28, 2018
@ulivz ulivz added version: next Planned to do or already included in the next(1.0.0) version and removed plugin scope labels Aug 20, 2018
@ulivz
Copy link
Member

ulivz commented Mar 9, 2019

We took a long time to develop the plugin API, for now you can create a plugin for that.

@sysebert
Copy link

Not sure which thread to subscribe to, but I'd love to know if this plugin was written by now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request Request to add a new feature version: next Planned to do or already included in the next(1.0.0) version
Projects
None yet
Development

No branches or pull requests

3 participants