Skip to content

Require json dynamically and syntax highlight  #393

Closed
@trongdong

Description

@trongdong

I'm writing a REST API documentation.
So my idea is to have all of the response in JSON format and require them in .md files.
For example:

{{ require('./get_customer.json') }}

This works pretty great so far and the only limitation is that it doesn't apply the code highlight.
Because vuepress parse .md to html and then use vue-loader to process the code.
As far as I understand, I have 2 options:

  1. Client processing: I'll use client js and when the page is rendered, apply the highlight js
  2. Server processing: because vuepress has prismjs built-in, I can create a vue component and has the server renders it.

Can anyone help me to figure out the right approach?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions