mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 02:06:31 +03:00
Allow prompt setting on code mixin
This commit is contained in:
parent
a29f132ffd
commit
52c6302223
|
@ -103,20 +103,20 @@ mixin button(url, trusted, ...style)
|
||||||
label - [string] aside title (optional or false for no label)
|
label - [string] aside title (optional or false for no label)
|
||||||
language - [string] language for syntax highlighting (default: "python")
|
language - [string] language for syntax highlighting (default: "python")
|
||||||
supports basic relevant languages available for PrismJS
|
supports basic relevant languages available for PrismJS
|
||||||
icon - [string] icon to display next to code block, mostly used for old/new
|
prompt - [string] prompt or icon to display next to code block, (mostly used for old/new)
|
||||||
height - [integer] optional height to clip code block to
|
height - [integer] optional height to clip code block to
|
||||||
|
|
||||||
mixin code(label, language, icon, height)
|
mixin code(label, language, prompt, height)
|
||||||
pre.c-code-block.o-block(class="lang-#{(language || DEFAULT_SYNTAX)}" class=icon ? "c-code-block--has-icon" : null style=height ? "height: #{height}px" : null)&attributes(attributes)
|
pre.c-code-block.o-block(class="lang-#{(language || DEFAULT_SYNTAX)}" class=icon ? "c-code-block--has-icon" : null style=height ? "height: #{height}px" : null)&attributes(attributes)
|
||||||
if label
|
if label
|
||||||
h4.u-text-label.u-text-label--dark=label
|
h4.u-text-label.u-text-label--dark=label
|
||||||
|
- var icon = (prompt == 'accept' || prompt == 'reject')
|
||||||
if icon
|
if icon
|
||||||
- var classes = {'accept': 'u-color-green', 'reject': 'u-color-red'}
|
- var classes = {'accept': 'u-color-green', 'reject': 'u-color-red'}
|
||||||
.c-code-block__icon(class=classes[icon] || null class=classes[icon] ? "c-code-block__icon--border" : null)
|
.c-code-block__icon(class=classes[icon] || null class=classes[icon] ? "c-code-block__icon--border" : null)
|
||||||
+icon(icon, 18)
|
+icon(icon, 18)
|
||||||
|
|
||||||
code.c-code-block__content
|
code.c-code-block__content(data-prompt=icon ? null : prompt)
|
||||||
block
|
block
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,13 @@
|
||||||
font: normal normal 1.1rem/#{2} $font-code
|
font: normal normal 1.1rem/#{2} $font-code
|
||||||
padding: 1em 2em
|
padding: 1em 2em
|
||||||
|
|
||||||
|
&[data-prompt]:before,
|
||||||
|
content: attr(data-prompt)
|
||||||
|
margin-right: 0.65em
|
||||||
|
display: inline-block
|
||||||
|
vertical-align: middle
|
||||||
|
opacity: 0.5
|
||||||
|
|
||||||
|
|
||||||
//- Inline code
|
//- Inline code
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user