當前位置: 首頁>>代碼示例>>Python>>正文


Python dash_core_components.Markdown方法代碼示例

本文整理匯總了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] 
開發者ID:plotly,項目名稱:dash-recipes,代碼行數:25,代碼來源:dash-callback-factory.py

示例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])),
    ]) 
開發者ID:plotly,項目名稱:dash-recipes,代碼行數:24,代碼來源:multi-page-dropdown.py

示例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/>") 
開發者ID:equinor,項目名稱:webviz-config,代碼行數:26,代碼來源:_markdown.py

示例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 
開發者ID:jackdbd,項目名稱:dash-earthquakes,代碼行數:22,代碼來源:app.py

示例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
    ) 
開發者ID:plotly,項目名稱:dash-docs,代碼行數:21,代碼來源:Markdown.py

示例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))
    ) 
開發者ID:plotly,項目名稱:dash-svm,代碼行數:23,代碼來源:dash_reusable_components.py

示例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 
開發者ID:MolSSI,項目名稱:QCFractal,代碼行數:23,代碼來源:landing.py

示例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,
        ) 
開發者ID:equinor,項目名稱:webviz-config,代碼行數:7,代碼來源:_syntax_highlighter.py

示例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,
        ) 
開發者ID:equinor,項目名稱:webviz-config,代碼行數:8,代碼來源:_markdown.py

示例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) 
開發者ID:equinor,項目名稱:webviz-config,代碼行數:4,代碼來源:_markdown.py

示例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)) 
開發者ID:plotly,項目名稱:dash-docs,代碼行數:6,代碼來源:filtering_advanced.py

示例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))))
    ]) 
開發者ID:plotly,項目名稱:dash-docs,代碼行數:11,代碼來源:filtering_advanced.py

示例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 
開發者ID:plotly,項目名稱:dash-docs,代碼行數:17,代碼來源:Markdown.py

示例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),
    ) 
開發者ID:plotly,項目名稱:dash-cytoscape,代碼行數:10,代碼來源:dash_reusable_components.py

示例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
                )
            ]
        )
    ]) 
開發者ID:plotly,項目名稱:dash-docs,代碼行數:57,代碼來源:utils.py


注:本文中的dash_core_components.Markdown方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。