docs: DRY up url helper, enable optional href

-when not passed a href, just use text
This commit is contained in:
Brian Mann
2017-06-17 17:44:03 -04:00
parent 4a9777efc3
commit 8892c71ef4
5 changed files with 7 additions and 5 deletions
+3 -1
View File
@@ -104,6 +104,7 @@ hexo.extend.tag.register('url', function (args) {
// {% url `.should()` should#Notes %}
// {% url 'Read about why' why-cypress %}
// {% url 'Benefits' guides/getting-started/why-cypress#Benefits %}
// {% url http://foo.com %}
//
// <<< Transforms into >>>
//
@@ -111,12 +112,13 @@ hexo.extend.tag.register('url', function (args) {
// <a href="/api/commands/should.html#Notes"><code>.should()</code></a>
// <a href="/guides/getting-started/why-cypress.html">Read about why</a>
// <a href="/guides/getting-started/why-cypress.html#Benefits">Benefits</a>
// <a href="http://foo.com">http://foo.com</a>
const sidebar = this.site.data.sidebar
const props = {
text: args[0],
url: args[1],
url: args[1] || args[0],
external: args[2],
}
@@ -4,7 +4,7 @@ comments: false
containerClass: examples
---
{% fa fa-github %} {% url "https://github.com/cypress-io/cypress-example-kitchensink" https://github.com/cypress-io/cypress-example-kitchensink %}
{% fa fa-github %} {% url https://github.com/cypress-io/cypress-example-kitchensink %}
## Overview
@@ -4,7 +4,7 @@ comments: false
containerClass: examples
---
{% fa fa-github %} {% url "https://github.com/cypress-io/cypress-example-phonecat" https://github.com/cypress-io/cypress-example-phonecat %}
{% fa fa-github %} {% url https://github.com/cypress-io/cypress-example-phonecat %}
## Overview
@@ -4,7 +4,7 @@ comments: false
containerClass: examples
---
{% fa fa-github %} {% url "https://github.com/cypress-io/cypress-example-piechopper" https://github.com/cypress-io/cypress-example-piechopper %}
{% fa fa-github %} {% url https://github.com/cypress-io/cypress-example-piechopper %}
## Overview
@@ -4,7 +4,7 @@ comments: false
containerClass: examples
---
{% fa fa-github %} {% url "https://github.com/cypress-io/cypress-example-todomvc" https://github.com/cypress-io/cypress-example-todomvc %}
{% fa fa-github %} {% url https://github.com/cypress-io/cypress-example-todomvc %}
## Overview