本文整理匯總了Python中dash_core_components.Markdown方法的典型用法代碼示例。如果您正苦於以下問題:Python dash_core_components.Markdown方法的具體用法?Python dash_core_components.Markdown怎麽用?Python dash_core_components.Markdown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dash_core_components
的用法示例。
在下文中一共展示了dash_core_components.Markdown方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: divs_list
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def divs_list():
return [html.Div([
dcc.Markdown(
'',
id='model-{}-markdown'.format(id)
),
html.P(
'',
id='model-{}-p'.format(id)
),
html.Button(
'Delete',
id='model-{}-delete-button'.format(id),
style={'width': '49%'}
),
html.Button(
'Start/Stop',
id='model-{}-toggle-button'.format(id),
style={'marginLeft': '2%', 'width': '49%'}
),
html.Hr()
], id='model-k2-{}'.format(id)) for id in IDS]
示例2: display_page
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def display_page(pathname):
return html.Div([
html.Div([
html.Span(
dcc.Link(link_mapping['/'], href="/") if pathname != '/' else 'Exhibit A',
style=styles['link']
),
html.Span(
dcc.Link(link_mapping['/exhibit-b'], href="/exhibit-b") if pathname != '/exhibit-b' else 'Exhibit B',
style=styles['link']
),
html.Span(
dcc.Link(link_mapping['/exhibit-c'], href="/exhibit-c") if pathname != '/exhibit-c' else 'Exhibit C',
style=styles['link']
)
]),
dcc.Markdown('### {}'.format(link_mapping[pathname])),
])
示例3: __init__
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def __init__(self, markdown_file: Path):
super().__init__()
self.markdown_file = markdown_file
self.html = bleach.clean(
markdown.markdown(
get_path(self.markdown_file).read_text(),
extensions=[
"tables",
"sane_lists",
_WebvizMarkdownExtension(base_path=markdown_file.parent),
],
),
tags=Markdown.ALLOWED_TAGS,
attributes=Markdown.ALLOWED_ATTRIBUTES,
styles=Markdown.ALLOWED_STYLES,
)
# Workaround for upstream issue https://github.com/plotly/dash-core-components/issues/746,
# where we convert void html tags from <tag> to <tag/>.
self.html = re.sub("<img (.*?[^/])>", r"<img \1/>", self.html)
self.html = self.html.replace("<br>", "<br/>").replace("<hr>", "<hr/>")
示例4: create_description
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def create_description():
div = html.Div(
children=[
dcc.Markdown('''
The redder the outer circle, the higher the magnitude. The darker
the inner circle, the deeper the earthquake.
> Currently no organization or government or scientist is capable
> of succesfully predicting the time and occurrence of an
> earthquake.
> — Michael Blanpied
Use the table below to know more about the {} earthquakes that
exceeded magnitude 4.5 last month.
***
'''.format(data['metadata']['count']).replace(' ', '')),
],
)
return div
示例5: Markdown
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def Markdown(children='', **kwargs):
children = replace_relative_links(children)
if kwargs.pop('escape_tags', False) and 'dccLink' in children:
# escape the HTML tags presented in the html component docstrings
# note that if these tags are within `backticks`, then we don't need
# to escape. so, let the caller determine whether or not to escape a
# section.
children = re.sub(
'\<(\w+)\>',
# for some reason, if we do `\<{}\>`, the first slash is shown in the
# rendered text.
lambda match: '<{}\> '.format(match.groups()[0]),
children
)
return dcc.Markdown(
children=children,
dangerously_allow_html=('dccLink' in children),
**kwargs
)
示例6: DemoDescription
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def DemoDescription(filename, strip=False):
with open(filename, 'r') as file:
text = file.read()
if strip:
text = text.split('<Start Description>')[-1]
text = text.split('<End Description>')[0]
return html.Div(
className='row',
style={
'padding': '15px 30px 27px',
'margin': '45px auto 45px',
'width': '80%',
'max-width': '1024px',
'borderRadius': 5,
'border': 'thin lightgrey solid',
'font-family': 'Roboto, sans-serif'
},
children=dcc.Markdown(dedent(text))
)
示例7: update_server_information
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def update_server_information(status):
config = current_app.config["FRACTAL_CONFIG"]
server = dcc.Markdown(
f"""
**Name:** {config.fractal.name}
**Query Limit:** {config.fractal.query_limit}
"""
)
database = dcc.Markdown(
f"""
**Name:** {config.database.database_name}
**Port:** {config.database.port}
**Host:** {config.database.host}
"""
)
queue = dcc.Graph(figure=task_graph())
return server, database, queue
示例8: layout
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def layout(self) -> dcc.Markdown:
return dcc.Markdown(
f"```\n{get_path(self.filename).read_text()}\n```",
highlight_config=self.config,
)
示例9: extendMarkdown
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def extendMarkdown(self, md: markdown.core.Markdown) -> None:
md.inlinePatterns.register(
item=_MarkdownImageProcessor(IMAGE_LINK_RE, md, self.base_path),
name="image_link",
priority=50,
)
示例10: layout
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def layout(self) -> dcc.Markdown:
return dcc.Markdown(self.html, dangerously_allow_html=True)
示例11: read_query
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def read_query(query):
if query is None:
return "No filter query"
return dcc.Markdown('`filter_query = "{}"`'.format(query))
示例12: display_query
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def display_query(query):
if query is None:
return ''
return html.Details([
html.Summary('Derived filter query structure'),
html.Div(dcc.Markdown('''```json
{}
```'''.format(json.dumps(query, indent=4))))
])
示例13: replace_relative_links
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def replace_relative_links(children):
children = re.sub(
']\((\/\S*)\)',
lambda match: ']({})'.format(tools.relpath(match.groups()[0])),
children
)
children = re.sub(
'href="(/\S*)"',
lambda match: 'href="{}"'.format(tools.relpath(match.groups()[0])),
children
)
return children
# Use our own Markdown function so that we can
# use `relpath` for the embedded URLs
示例14: SectionTitle
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def SectionTitle(title, size, align='center', color='#222'):
return html.Div(
style={
'text-align': align,
'color': color
},
children=dcc.Markdown('#' * size + ' ' + title),
)
示例15: imageComponentBlock
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Markdown [as 別名]
def imageComponentBlock(
example_string,
location,
height=None,
width=400
):
'''Generate a container that is visually similar to the
ComponentBlock for components that require an externally hosted image.
:param (str) example_string: String containing the code that is
used in the application from the image.
:param (str) location: The URL of the image.
:param (int) height: The height of the image.
:param (int) width: The width of the image.
:rtype (dict): A dash_html_components div containing the code
container and the image.
'''
try:
exec(example_string, {})
except Exception as e:
print('\nError running\n{}\n{}'.format(
example_string,
('======================================' +
'======================================')
))
raise e
demo_location = re.match('.*pic_(.*)\.png\?raw=true', location)
if demo_location is not None:
demo_location = demo_location.group(1)
else:
demo_location = ''
return html.Div([
rc.Markdown(
'```python \n' + example_string + ' \n```',
style=styles.code_container
),
html.Div(
className='example-container',
children=[
dcc.Markdown(
'> Try a live demo at http://dash-gallery.plotly.host/docs-demos-dashbio/{}'.format(demo_location, demo_location)
),
html.Img(
style={'border': 'none', 'width': '75%', 'max-width': '500px'},
src=location
)
]
)
])