-
Notifications
You must be signed in to change notification settings - Fork 4.7k
add feature to allow specifying language on import snippet markdown h… #1313
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
Closed
fabioaanthony
wants to merge
2
commits into
vuejs:master
from
fabioaanthony:feature/add-lang-flag-to-snippet-import-syntax
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 15 additions & 14 deletions
29
packages/@vuepress/markdown/__tests__/__snapshots__/containers.spec.js.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,36 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`containers danger 1`] = ` | ||
<div class="danger custom-block"> | ||
<p class="custom-block-title">WARNING</p> | ||
<p>I am a danger</p> | ||
"<div class=\\"danger custom-block\\"><p class=\\"custom-block-title\\">WARNING</p> | ||
<p>I am a danger</p> | ||
</div> | ||
" | ||
`; | ||
|
||
exports[`containers tip 1`] = ` | ||
<div class="tip custom-block"> | ||
<p class="custom-block-title">TIP</p> | ||
<p>I am a tip</p> | ||
"<div class=\\"tip custom-block\\"><p class=\\"custom-block-title\\">TIP</p> | ||
<p>I am a tip</p> | ||
</div> | ||
" | ||
`; | ||
|
||
exports[`containers tip-override 1`] = ` | ||
<div class="tip custom-block"> | ||
<p class="custom-block-title">提示</p> | ||
<p>I am a tip</p> | ||
"<div class=\\"tip custom-block\\"><p class=\\"custom-block-title\\">提示</p> | ||
<p>I am a tip</p> | ||
</div> | ||
" | ||
`; | ||
|
||
exports[`containers v-pre 1`] = ` | ||
<div v-pre> | ||
<p>I am a v-pre</p> | ||
"<div v-pre> | ||
<p>I am a v-pre</p> | ||
</div> | ||
" | ||
`; | ||
|
||
exports[`containers warning 1`] = ` | ||
<div class="warning custom-block"> | ||
<p class="custom-block-title">WARNING</p> | ||
<p>I am a warning</p> | ||
"<div class=\\"warning custom-block\\"><p class=\\"custom-block-title\\">WARNING</p> | ||
<p>I am a warning</p> | ||
</div> | ||
" | ||
`; |
3 changes: 2 additions & 1 deletion
3
packages/@vuepress/markdown/__tests__/__snapshots__/highlight.spec.js.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`highlight should highlight code 1`] = ` | ||
<pre v-pre class="language-js"><code><span class="token keyword">new</span> <span class="token class-name">Vue</span><span class="token punctuation">(</span><span class="token punctuation">)</span> | ||
"<pre v-pre class=\\"language-js\\"><code><span class=\\"token keyword\\">new</span> <span class=\\"token class-name\\">Vue</span><span class=\\"token punctuation\\">(</span><span class=\\"token punctuation\\">)</span> | ||
</code></pre> | ||
" | ||
`; |
22 changes: 9 additions & 13 deletions
22
packages/@vuepress/markdown/__tests__/__snapshots__/highlightLines.spec.js.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`highlightLines highlight multiple lines 1`] = ` | ||
<div class="highlight-lines"> | ||
<div class="highlighted"> </div> | ||
<div class="highlighted"> </div> | ||
<br> | ||
<div class="highlighted"> </div> | ||
<div class="highlighted"> </div> | ||
<br> | ||
<br> | ||
</div>const app = new Vue({ render, router }) app.$mount('#app') | ||
"<div class=\\"highlight-lines\\"><div class=\\"highlighted\\"> </div><div class=\\"highlighted\\"> </div><br><div class=\\"highlighted\\"> </div><div class=\\"highlighted\\"> </div><br><br></div>const app = new Vue({ | ||
render, | ||
router | ||
}) | ||
|
||
app.$mount('#app') | ||
" | ||
`; | ||
|
||
exports[`highlightLines highlight single line 1`] = ` | ||
<div class="highlight-lines"> | ||
<div class="highlighted"> </div> | ||
<br> | ||
</div>new Vue() | ||
"<div class=\\"highlight-lines\\"><div class=\\"highlighted\\"> </div><br></div>new Vue() | ||
" | ||
`; |
17 changes: 11 additions & 6 deletions
17
packages/@vuepress/markdown/__tests__/__snapshots__/hoist.spec.js.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,35 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`hoist Should keep script and style when not using hoist 1`] = ` | ||
<h1>H1</h1> | ||
<script src="vue.js"></script> | ||
"<h1>H1</h1> | ||
<script src=\\"vue.js\\"></script> | ||
<style> | ||
.vue { | ||
font-size: 16px; | ||
} | ||
</style> | ||
<h2>H2</h2> | ||
" | ||
`; | ||
|
||
exports[`hoist Should miss script and style when using hoist 1`] = ` | ||
<h1>H1</h1> | ||
"<h1>H1</h1> | ||
<h2>H2</h2> | ||
" | ||
`; | ||
|
||
exports[`hoist Should miss script and style when using hoist 2`] = ` | ||
Object { | ||
"__data_block": Object {}, | ||
"hoistedTags": Array [ | ||
<script src="vue.js"></script>, | ||
<style> | ||
"<script src=\\"vue.js\\"></script> | ||
", | ||
"<style> | ||
.vue { | ||
font-size: 16px; | ||
} | ||
</style>, | ||
</style> | ||
", | ||
], | ||
} | ||
`; |
22 changes: 4 additions & 18 deletions
22
packages/@vuepress/markdown/__tests__/__snapshots__/lineNumers.spec.js.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,12 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`lineNumbers should lineNumbers work with highlightLines 1`] = ` | ||
<!--beforebegin--> | ||
<div class="language-js line-numbers-mode"> | ||
<!--afterbegin--> | ||
<div class="highlight-lines"> | ||
<div class="highlighted"> </div> | ||
<br> | ||
</div>new Vue() | ||
<div class="line-numbers-wrapper"></div> | ||
<!--beforeend--> | ||
</div> | ||
<!--afterend--> | ||
"<!--beforebegin--><div class=\\"language-js line-numbers-mode\\"><!--afterbegin--><div class=\\"highlight-lines\\"><div class=\\"highlighted\\"> </div><br></div>new Vue() | ||
<div class=\\"line-numbers-wrapper\\"></div><!--beforeend--></div><!--afterend-->" | ||
`; | ||
|
||
exports[`lineNumbers should render lineNumbers 1`] = ` | ||
<!--beforebegin--> | ||
<div class="language-js line-numbers-mode"> | ||
<!--afterbegin--><pre><code class="language-js">new Vue() | ||
"<!--beforebegin--><div class=\\"language-js line-numbers-mode\\"><!--afterbegin--><pre><code class=\\"language-js\\">new Vue() | ||
</code></pre> | ||
<div class="line-numbers-wrapper"></div> | ||
<!--beforeend--> | ||
</div> | ||
<!--afterend--> | ||
<div class=\\"line-numbers-wrapper\\"></div><!--beforeend--></div><!--afterend-->" | ||
`; |
21 changes: 6 additions & 15 deletions
21
packages/@vuepress/markdown/__tests__/__snapshots__/link.spec.js.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`link should render external links correctly 1`] = ` | ||
<p> | ||
<a href="https://vuejs.org/" target="_blank" rel="noopener noreferrer">vue | ||
<OutboundLink/> | ||
</a> | ||
</p> | ||
"<p><a href=\\"https://vuejs.org/\\" target=\\"_blank\\" rel=\\"noopener noreferrer\\">vue<OutboundLink/></a></p> | ||
" | ||
`; | ||
|
||
exports[`link should render external links correctly 2`] = ` | ||
<p> | ||
<a href="http://vuejs.org/" target="_blank" rel="noopener noreferrer">vue | ||
<OutboundLink/> | ||
</a> | ||
</p> | ||
"<p><a href=\\"http://vuejs.org/\\" target=\\"_blank\\" rel=\\"noopener noreferrer\\">vue<OutboundLink/></a></p> | ||
" | ||
`; | ||
|
||
exports[`link should render external links correctly 3`] = ` | ||
<p> | ||
<a href="https://google.com" target="_blank" rel="noopener noreferrer">some <strong>link</strong> with <code>code</code> | ||
<OutboundLink/> | ||
</a> | ||
</p> | ||
"<p><a href=\\"https://google.com\\" target=\\"_blank\\" rel=\\"noopener noreferrer\\">some <strong>link</strong> with <code>code</code><OutboundLink/></a></p> | ||
" | ||
`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../@vuepress/markdown/__tests__/fragments/code-snippet-highlightLines-multiple.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<<< @/packages/@vuepress/core/__test__/markdown/fragments/snippet.js{1-3} | ||
<<< @/packages/@vuepress/markdown/__tests__/fragments/snippet.js{1-3} |
3 changes: 3 additions & 0 deletions
3
...__tests__/fragments/code-snippet-highlightLines-single-specify-language-ruby.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<<< @/packages/@vuepress/markdown/__tests__/fragments/snippet.rb{1,3} lang=ruby | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...es/@vuepress/markdown/__tests__/fragments/code-snippet-highlightLines-single.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<<< @/packages/@vuepress/core/__test__/markdown/fragments/snippet.js{1,3} | ||
<<< @/packages/@vuepress/markdown/__tests__/fragments/snippet.js{1,3} |
1 change: 1 addition & 0 deletions
1
...es/@vuepress/markdown/__tests__/fragments/code-snippet-specify-language-ruby.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<<< @/packages/@vuepress/markdown/__tests__/fragments/snippet.rb lang=ruby |
2 changes: 1 addition & 1 deletion
2
packages/@vuepress/markdown/__tests__/fragments/code-snippet.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<<< @/packages/@vuepress/core/__test__/markdown/fragments/snippet.js | ||
<<< @/packages/@vuepress/markdown/__tests__/fragments/snippet.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
def vuepress | ||
puts 'vuepress' | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.