Skip to content

Commit

Permalink
feat: add online demo for markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
plantain-00 committed Sep 20, 2020
1 parent 4a03503 commit bee6352
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion online/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
.graphql-root-type,
.swagger-doc,
.custom,
.typescript {
.typescript,
.markdown {
display: block;
padding: 9.5px;
margin: 3px 0 10px 3px;
Expand Down
1 change: 1 addition & 0 deletions online/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
<pre class="swagger-doc" v-if="selectedOption === 'swagger doc'">{{swaggerDoc}}</pre>
<pre class="custom" v-if="selectedOption === 'custom'">{{custom}}</pre>
<pre class="typescript" v-if="selectedOption === 'typescript'">{{typescript}}</pre>
<pre class="markdown" v-if="selectedOption === 'markdown'">{{markdown}}</pre>
</div>
</div>
4 changes: 4 additions & 0 deletions online/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class App extends Vue {
swaggerDoc = ''
custom = ''
typescript = ''
markdown = ''
private innerSource = localStorage.getItem(localStorageKey) || demoCasesTs
private jsonSchemas: { entry: string; content: string }[] = []

Expand Down Expand Up @@ -90,6 +91,9 @@ export class App extends Vue {

this.typescript = generator.generateTypescript()
this.options.push('typescript')

this.markdown = generator.generateMarkdownDoc()
this.options.push('markdown')
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion online/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ export interface BlogChange {
}
`
// @ts-ignore
export function indexTemplateHtml(this: App) {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"app"},[_c('textarea',{directives:[{name:"model",rawName:"v-model",value:(_vm.source),expression:"source"}],staticClass:"source",domProps:{"value":(_vm.source)},on:{"input":function($event){if($event.target.composing){ return; }_vm.source=$event.target.value}}}),_vm._v(" "),_c('div',{staticClass:"result"},[_c('button',{on:{"click":function($event){return _vm.generate()}}},[_vm._v("generate")]),_vm._v(" "),_c('div',{staticClass:"options"},[_c('select',{directives:[{name:"model",rawName:"v-model",value:(_vm.selectedOption),expression:"selectedOption"}],on:{"change":function($event){var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return val}); _vm.selectedOption=$event.target.multiple ? $$selectedVal : $$selectedVal[0]}}},_vm._l((_vm.options),function(option){return _c('option',{key:option,domProps:{"value":option}},[_vm._v(_vm._s(option))])}),0)]),_vm._v(" "),(_vm.selectedOption === 'protobuf')?_c('pre',{staticClass:"protobuf"},[_vm._v(_vm._s(_vm.protobuf))]):_vm._e(),_vm._v(" "),(_vm.jsonSchema)?_c('pre',{staticClass:"json-schema"},[_vm._v(_vm._s(_vm.jsonSchema))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'graphql schema')?_c('pre',{staticClass:"graphql-schema"},[_vm._v(_vm._s(_vm.graphqlSchema))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'reason types')?_c('pre',{staticClass:"reason-types"},[_vm._v(_vm._s(_vm.reasonTypes))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'ocaml types')?_c('pre',{staticClass:"ocaml-types"},[_vm._v(_vm._s(_vm.ocamlTypes))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'rust types')?_c('pre',{staticClass:"rust-types"},[_vm._v(_vm._s(_vm.rustTypes))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'mongoose schema')?_c('pre',{staticClass:"mongoose-schema"},[_vm._v(_vm._s(_vm.mongooseSchema))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'graphql root type')?_c('pre',{staticClass:"graphql-root-type"},[_vm._v(_vm._s(_vm.graphqlRootType))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'swagger doc')?_c('pre',{staticClass:"swagger-doc"},[_vm._v(_vm._s(_vm.swaggerDoc))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'custom')?_c('pre',{staticClass:"custom"},[_vm._v(_vm._s(_vm.custom))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'typescript')?_c('pre',{staticClass:"typescript"},[_vm._v(_vm._s(_vm.typescript))]):_vm._e()])])}
export function indexTemplateHtml(this: App) {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"app"},[_c('textarea',{directives:[{name:"model",rawName:"v-model",value:(_vm.source),expression:"source"}],staticClass:"source",domProps:{"value":(_vm.source)},on:{"input":function($event){if($event.target.composing){ return; }_vm.source=$event.target.value}}}),_vm._v(" "),_c('div',{staticClass:"result"},[_c('button',{on:{"click":function($event){return _vm.generate()}}},[_vm._v("generate")]),_vm._v(" "),_c('div',{staticClass:"options"},[_c('select',{directives:[{name:"model",rawName:"v-model",value:(_vm.selectedOption),expression:"selectedOption"}],on:{"change":function($event){var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return val}); _vm.selectedOption=$event.target.multiple ? $$selectedVal : $$selectedVal[0]}}},_vm._l((_vm.options),function(option){return _c('option',{key:option,domProps:{"value":option}},[_vm._v(_vm._s(option))])}),0)]),_vm._v(" "),(_vm.selectedOption === 'protobuf')?_c('pre',{staticClass:"protobuf"},[_vm._v(_vm._s(_vm.protobuf))]):_vm._e(),_vm._v(" "),(_vm.jsonSchema)?_c('pre',{staticClass:"json-schema"},[_vm._v(_vm._s(_vm.jsonSchema))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'graphql schema')?_c('pre',{staticClass:"graphql-schema"},[_vm._v(_vm._s(_vm.graphqlSchema))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'reason types')?_c('pre',{staticClass:"reason-types"},[_vm._v(_vm._s(_vm.reasonTypes))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'ocaml types')?_c('pre',{staticClass:"ocaml-types"},[_vm._v(_vm._s(_vm.ocamlTypes))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'rust types')?_c('pre',{staticClass:"rust-types"},[_vm._v(_vm._s(_vm.rustTypes))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'mongoose schema')?_c('pre',{staticClass:"mongoose-schema"},[_vm._v(_vm._s(_vm.mongooseSchema))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'graphql root type')?_c('pre',{staticClass:"graphql-root-type"},[_vm._v(_vm._s(_vm.graphqlRootType))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'swagger doc')?_c('pre',{staticClass:"swagger-doc"},[_vm._v(_vm._s(_vm.swaggerDoc))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'custom')?_c('pre',{staticClass:"custom"},[_vm._v(_vm._s(_vm.custom))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'typescript')?_c('pre',{staticClass:"typescript"},[_vm._v(_vm._s(_vm.typescript))]):_vm._e(),_vm._v(" "),(_vm.selectedOption === 'markdown')?_c('pre',{staticClass:"markdown"},[_vm._v(_vm._s(_vm.markdown))]):_vm._e()])])}
// @ts-ignore
export var indexTemplateHtmlStatic = [ ]
/* eslint-enable */
Expand Down

0 comments on commit bee6352

Please sign in to comment.