diff --git a/docs/basic.rst b/docs/basic.rst index 7e9224e3..4affac45 100644 --- a/docs/basic.rst +++ b/docs/basic.rst @@ -67,6 +67,9 @@ If you want to apply a strict Content Security Policy (CSP), you can pass ``nonc E.g. if using `Talisman `_ it can be called with ``bootstrap.load_js(nonce=csp_nonce())``. +In order to use icon font, there is an additional helper called ``bootstrap.load_icon_font_css()``. +This is used only by ``render_icon(..., font=True)``. See its also the documentation for that marco. + Starter template ---------------- diff --git a/docs/macros.rst b/docs/macros.rst index 83bee9b1..7b80f2b5 100644 --- a/docs/macros.rst +++ b/docs/macros.rst @@ -607,7 +607,9 @@ By default, it will enable the CSRF token check for all the POST requests, read render_icon() ------------- -Render a Bootstrap icon. +Render a Bootstrap icon. This is either an SVG with a ``use`` element which refers to a locally hosted SVG sprite with an fragment identifier. +Note that serving the SVG sprite across a domain has an `issue with Chrome `_. +Or it is possible to have a font icon rendered. This does support``BOOTSTRAP_SERVE_LOCAL`` but requires ``bootstrap.load_icon_font_css()`` in the template header. Example ~~~~~~~ @@ -621,7 +623,7 @@ Example API ~~~~ -.. py:function:: render_icon(name, size=config.BOOTSTRAP_ICON_SIZE, color=config.BOOTSTRAP_ICON_COLOR, title=None, desc=None) +.. py:function:: render_icon(name, size=config.BOOTSTRAP_ICON_SIZE, color=config.BOOTSTRAP_ICON_COLOR, title=None, desc=None, font=False) :param name: The name of icon, you can find all available names at `Bootstrap Icon `_. :param size: The size of icon, you can pass any vaild size value (e.g. ``32``/``'32px'``, ``1.5em``, etc.), default to @@ -629,5 +631,6 @@ API :param color: The color of icon, follow the context with ``currentColor`` if not set. Accept values are Bootstrap style name (one of ``['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark', 'muted']``) or any valid color string (e.g. ``'red'``, ``'#ddd'`` or ``'(250, 250, 250)'``), default to use configuration ``BOOTSTRAP_ICON_COLOR`` (default value is ``None``). - :param title: The title of the icon for accessibility support. - :param desc: The description of the icon for accessibility support. + :param title: The title of the icon for accessibility support. This is not supported for ``font=True``. + :param desc: The description of the icon for accessibility support. This is not supported for ``font=True``. + :param font: Default to generate ````, if set to ``True``, it will generate ```` which uses icon font. diff --git a/examples/bootstrap4/templates/base.html b/examples/bootstrap4/templates/base.html index ca88b847..682f811a 100644 --- a/examples/bootstrap4/templates/base.html +++ b/examples/bootstrap4/templates/base.html @@ -8,6 +8,7 @@ Bootstrap-Flask Demo Application {{ bootstrap.load_css() }} + {{ bootstrap.load_icon_font_css() }}