Sandbox - Highlight

Sandbox - Highlight
This is example text with {{< mark-code >}}__init.d__    with **bold text**{{< /mark-code >}} word and with some html tags like: {{< mark-code class="bs-font-color-blue-700" >}}<h2>some H2 header</h2>{{< /mark-code >}}

This is example text with __init.d__ with **bold text** word and with some html tags like: <h2>some H2 header</h2>

My own pre/code

{{< toHTML >}}
<pre class="chroma">
R1# <span class="bs-font-color-black fw-bold"><strong>configure terminal</strong></span>
R1(config)# <span class="bs-font-color-black fw-bold"><strong>interface <span class="bs-font-color-orange-700">gigabitethernet 0/0</span></strong></span>
R1(config-if)# <span class="bs-font-color-black fw-bold"><strong>description <span class="bs-font-color-orange-700">Link to LAN 1</span></strong></span>
R1(config-if)# <span class="bs-font-color-black fw-bold"><strong>ip address <span class="bs-font-color-orange-700">192.168.10.1 255.255.255.0</span></strong></span>
R1(config-if)# <span class="bs-font-color-black fw-bold"><strong>no shutdown</strong></span>
R1(config-if)# <span class="bs-font-color-black fw-bold"><strong>exit</strong></span>

<span class="bs-font-color-gray-600">* Jan 30 22:04:47.551: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to down</span>
<span class="bs-font-color-gray-600">* Jan 30 22:04:50.899: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up</span>
<span class="bs-font-color-gray-600">* Jan 30 22:04:51.899: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up</span>

R1(config)#
R1(config)# <span class="bs-font-color-black fw-bold"><strong>interface <span class="bs-font-color-cyan-700">gigabitethernet 0/1</span></strong></span>
R1(config-if)# <span class="bs-font-color-black fw-bold"><strong>description <span class="bs-font-color-cyan-700">Link to LAN 2</span></strong></span>
R1(config-if)# <span class="bs-font-color-black fw-bold"><strong>ip address <span class="bs-font-color-cyan-700">192.168.11.1 255.255.255.0</span></strong></span>
R1(config-if)# <span class="bs-font-color-black fw-bold"><strong>no shutdown</strong></span>
R1(config-if)# <span class="bs-font-color-black fw-bold"><strong>exit</strong></span>

<span class="bs-font-color-gray-600">Output from Switch sw1-member1-hrdlo1</span>
sw1-member1-hrdlo1# <span class="bs-font-color-black fw-bold"><strong>show interfaces status</strong></span>

Port      Name               Status       Vlan       Duplex  Speed Type
Gi1/0/1   CRA-primary        connected    75         a-full a-1000 10/100/1000BaseTX
<span class="bs-font-color-red-600"><strong>Gi1/0/2   po1-to_sw-hrdlo3   connected    trunk      a-full a-1000 10/100/1000BaseTX</strong></span>
Gi1/0/3                      connected    48         a-full  a-100 10/100/1000BaseTX
Gi1/0/4                      connected    48         a-full  a-100 10/100/1000BaseTX
Gi1/0/5   ucs-oper-712       connected    52         a-full  a-100 10/100/1000BaseTX
</pre>
{{< /toHTML >}}
R1# configure terminal
R1(config)# interface gigabitethernet 0/0
R1(config-if)# description Link to LAN 1
R1(config-if)# ip address 192.168.10.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit

* Jan 30 22:04:47.551: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to down
* Jan 30 22:04:50.899: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
* Jan 30 22:04:51.899: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up

R1(config)#
R1(config)# interface gigabitethernet 0/1
R1(config-if)# description Link to LAN 2
R1(config-if)# ip address 192.168.11.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit

Output from Switch sw1-member1-hrdlo1
sw1-member1-hrdlo1# show interfaces status

Port      Name               Status       Vlan       Duplex  Speed Type
Gi1/0/1   CRA-primary        connected    75         a-full a-1000 10/100/1000BaseTX
Gi1/0/2   po1-to_sw-hrdlo3   connected    trunk      a-full a-1000 10/100/1000BaseTX
Gi1/0/3                      connected    48         a-full  a-100 10/100/1000BaseTX
Gi1/0/4                      connected    48         a-full  a-100 10/100/1000BaseTX
Gi1/0/5   ucs-oper-712       connected    52         a-full  a-100 10/100/1000BaseTX

Hugo HTML comment in template/shortcode

{{ "<!-- This is an HTML comment -->" | safeHTML }}
{{ printf "<!-- Our website is named: %s -->" .Site.Title | safeHTML }}
<!-- {{ $author := "Emma Goldman" }} was a great woman. -->
{{ $author }}

Some code highliht examples

from fastapi import FastAPI, Request, Response, Header, Depends, HTTPException, status
from fastapi.exceptions import RequestValidationError, ValidationError, HTTPException
from fastapi.responses import JSONResponse, PlainTextResponse, HTMLResponse, RedirectResponse, FileResponse
import json
import os.path
import time
import uvicorn

import app_config
import app_counter.routes

cfg = app_config.get_settings()

app = FastAPI(
    title = 'Python API from @rama',
    license_info={
        'name': 'Apache 2.0',
        'url' : 'https://www.apache.org/licenses/LICENSE-2.0.html',
    },
    description = cfg.description,
    version = '0.8.2',
)

app.include_router(app_counter.routes.router, prefix="/api/counter", tags=["counter"])

@app.exception_handler(RequestValidationError)
@app.exception_handler(ValidationError)
async def validation_exception_handler(request, exc):
    print(f"OMG! The client sent invalid data!: {exc}")
    exc_json = json.loads(exc.json())
    response = {"message": [], "data": None}

    for error in exc_json:
        response['message'].append(error['loc'][-1]+f": {error['msg']}")

    return JSONResponse(response, status_code=422)


@app.middleware("http")
async def add_process_time_header(request: Request, call_next):
    start_time = time.time()
    response = await call_next(request)
    process_time = time.time() - start_time
    response.headers["X-Process-Time"] = str(process_time)
    return response


if __name__ == "__main__":
    uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) 
telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 mailserver.secar.cz ESMTP
ehlo fakemailserver.com                                 # Here start email envelope
250-mailserver.secar.cz
mail from: <FakeEnvelopeSender@fakedomain.com>          # Fake envelope sender
250 2.1.0 Ok
rcpt to: <manak@secar.cz>                               # Real recipient in mail routing
250 2.1.5 Ok
data                                                    # Here end email envelope and start email header
354 End data with <CR><LF>.<CR><LF>
From: "Fake Sender" <FakeHeaderSender@fakedomain.com>   # Fake email header sender
To: "Real Recipient Name" <manak@secar.cz>              # email header recipient (what you see in your email client)
Subject: test fake sender message                       # email header subject

This is test meassage                                   # After one empty line email header end and start email body

.
250 2.0.0 Ok: queued as 44DxhQ58Jgz6tvJ
quit                                                    # We end the smtp communication with recipient mailserver
221 2.0.0 Bye
Connection closed by foreign host.                      # tcp connection is closed
{{< highlight go "linenos=table,hl_lines=8 15-17" >}}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
// GetTitleFunc returns a func that can be used to transform a string to
// title case.
//
// The supported styles are
//
// - "Go" (strings.Title)
// - "AP" (see https://www.apstylebook.com/)
// - "Chicago" (see https://www.chicagomanualofstyle.org/home.html) This is very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long text
//
// If an unknown or empty style is provided, AP style is what you get.
func GetTitleFunc(style string) func(s string) string {
  switch strings.ToLower(style) {
  case "go":
    return strings.Title
  case "chicago":
    return transform.NewTitleConverter(transform.ChicagoStyle)
  default:
    return transform.NewTitleConverter(transform.APStyle)
  }
}

```go {linenos=table,hl_lines=[8,"15-17"],linenostart=199}
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
// GetTitleFunc returns a func that can be used to transform a string to
// title case.
//
// The supported styles are
//
// - "Go" (strings.Title)
// - "AP" (see https://www.apstylebook.com/)
// - "Chicago" (see https://www.chicagomanualofstyle.org/home.html) This is very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long text
//
// If an unknown or empty style is provided, AP style is what you get.
func GetTitleFunc(style string) func(s string) string {
  switch strings.ToLower(style) {
  case "go":
    return strings.Title
  case "chicago":
    return transform.NewTitleConverter(transform.ChicagoStyle)
  default:
    return transform.NewTitleConverter(transform.APStyle)
  }
}
example text               .highlight .c { color: #999988; font-style: italic } /* Comment */
example text             .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
example text               .highlight .k { font-weight: bold } /* Keyword */
example text               .highlight .o { font-weight: bold } /* Operator */
example text              .highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
example text              .highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
example text              .highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
example text              .highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
example text              .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
example text              .highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
example text              .highlight .ge { font-style: italic } /* Generic.Emph */
example text              .highlight .gr { color: #aa0000 } /* Generic.Error */
example text              .highlight .gh { color: #999999 } /* Generic.Heading */
example text              .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
example text              .highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
example text              .highlight .go { color: #888888 } /* Generic.Output */
example text              .highlight .gp { color: #555555 } /* Generic.Prompt */
example text              .highlight .gs { font-weight: bold } /* Generic.Strong */
example text              .highlight .gu { color: #aaaaaa } /* Generic.Subheading */
example text              .highlight .gt { color: #aa0000 } /* Generic.Traceback */
example text              .highlight .kc { font-weight: bold } /* Keyword.Constant */
example text              .highlight .kd { font-weight: bold } /* Keyword.Declaration */
example text              .highlight .kp { font-weight: bold } /* Keyword.Pseudo */
example text              .highlight .kr { font-weight: bold } /* Keyword.Reserved */
example text              .highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
example text               .highlight .m { color: #009999 } /* Literal.Number */
example text               .highlight .s { color: #dd1144 } /* Literal.String */
example text              .highlight .na { color: #008080 } /* Name.Attribute */
example text              .highlight .nb { color: #0086B3 } /* Name.Builtin */
example text              .highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
example text              .highlight .no { color: #008080 } /* Name.Constant */
example text              .highlight .ni { color: #800080 } /* Name.Entity */
example text              .highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
example text              .highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
example text              .highlight .nn { color: #555555 } /* Name.Namespace */
example text              .highlight .nt { color: #000080 } /* Name.Tag */
example text              .highlight .nv { color: #008080 } /* Name.Variable */
example text              .highlight .ow { font-weight: bold } /* Operator.Word */
example text               .highlight .w { color: #bbbbbb } /* Text.Whitespace */
example text              .highlight .mf { color: #009999 } /* Literal.Number.Float */
example text              .highlight .mh { color: #009999 } /* Literal.Number.Hex */
example text              .highlight .mi { color: #009999 } /* Literal.Number.Integer */
example text              .highlight .mo { color: #009999 } /* Literal.Number.Oct */
example text              .highlight .sb { color: #dd1144 } /* Literal.String.Backtick */
example text              .highlight .sc { color: #dd1144 } /* Literal.String.Char */
example text              .highlight .sd { color: #dd1144 } /* Literal.String.Doc */
example text              .highlight .s2 { color: #dd1144 } /* Literal.String.Double */
example text              .highlight .se { color: #dd1144 } /* Literal.String.Escape */
example text              .highlight .sh { color: #dd1144 } /* Literal.String.Heredoc */
example text              .highlight .si { color: #dd1144 } /* Literal.String.Interpol */
example text              .highlight .sx { color: #dd1144 } /* Literal.String.Other */
example text              .highlight .sr { color: #009926 } /* Literal.String.Regex */
example text              .highlight .s1 { color: #dd1144 } /* Literal.String.Single */
example text              .highlight .ss { color: #990073 } /* Literal.String.Symbol */
example text              .highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
example text              .highlight .vc { color: #008080 } /* Name.Variable.Class */
example text              .highlight .vg { color: #008080 } /* Name.Variable.Global */
example text              .highlight .vi { color: #008080 } /* Name.Variable.Instance */
example text              .highlight .il { color: #009999 } /* Literal.Number.Integer.Long */

SUBSCRIBE FOR NEW ARTICLES

@
comments powered by Disqus