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

Require json dynamically and syntax highlight #393

Closed
trongdong opened this issue May 10, 2018 · 3 comments
Closed

Require json dynamically and syntax highlight #393

trongdong opened this issue May 10, 2018 · 3 comments

Comments

@trongdong
Copy link

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?

@ycmjason
Copy link
Contributor

This could possibly be solved by the proposal of including markdown partial (#227).

You can then do

README.md

<!-- include ./get_customer.md -->

get_customer.md

```json
{ ... }
```

@trongdong
Copy link
Author

@ycmjason interesting

@ulivz ulivz added 1.0.0 and removed 1.0.0 labels May 11, 2018
@ulivz
Copy link
Member

ulivz commented May 15, 2018

Duplicate of #222

@ulivz ulivz closed this as completed May 15, 2018
@ulivz ulivz marked this as a duplicate of #222 May 15, 2018
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

3 participants