|
| 1 | +--- |
| 2 | +title: "Code Fence" |
| 3 | +emoji: 👩💻 |
| 4 | +type: "tech" # or "idea" |
| 5 | +topics: |
| 6 | + - React |
| 7 | + - Rust |
| 8 | +published: false |
| 9 | +--- |
| 10 | + |
| 11 | +```"><img/onerror="alert(location)"src=.> |
| 12 | +any |
| 13 | +``` |
| 14 | + |
| 15 | +```tf |
| 16 | +terraform { |
| 17 | + required_providers { |
| 18 | + aws = { |
| 19 | + source = "hashicorp/aws" |
| 20 | + version = "~> 1.0.4" |
| 21 | + } |
| 22 | + } |
| 23 | +} |
| 24 | +
|
| 25 | +variable "aws_region" {} |
| 26 | +
|
| 27 | +variable "base_cidr_block" { |
| 28 | + description = "A /16 CIDR range definition, such as 10.1.0.0/16, that the VPC will use" |
| 29 | + default = "10.1.0.0/16" |
| 30 | +} |
| 31 | +
|
| 32 | +variable "availability_zones" { |
| 33 | + description = "A list of availability zones in which to create subnets" |
| 34 | + type = list(string) |
| 35 | +} |
| 36 | +
|
| 37 | +provider "aws" { |
| 38 | + region = var.aws_region |
| 39 | +} |
| 40 | +
|
| 41 | +resource "aws_vpc" "main" { |
| 42 | + # Referencing the base_cidr_block variable allows the network address |
| 43 | + # to be changed without modifying the configuration. |
| 44 | + cidr_block = var.base_cidr_block |
| 45 | +} |
| 46 | +
|
| 47 | +resource "aws_subnet" "az" { |
| 48 | + # Create one subnet for each given availability zone. |
| 49 | + count = length(var.availability_zones) |
| 50 | +
|
| 51 | + # For each subnet, use one of the specified availability zones. |
| 52 | + availability_zone = var.availability_zones[count.index] |
| 53 | +
|
| 54 | + # By referencing the aws_vpc.main object, Terraform knows that the subnet |
| 55 | + # must be created only after the VPC is created. |
| 56 | + vpc_id = aws_vpc.main.id |
| 57 | +
|
| 58 | + # Built-in functions and operators can be used for simple transformations of |
| 59 | + # values, such as computing a subnet address. Here we create a /20 prefix for |
| 60 | + # each subnet, using consecutive addresses for each availability zone, |
| 61 | + # such as 10.1.16.0/20 . |
| 62 | + cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 4, count.index+1) |
| 63 | +} |
| 64 | +``` |
| 65 | + |
| 66 | +ref: https://github.com/zenn-dev/zenn-community/issues/357 |
| 67 | + |
| 68 | +<!-- should ignore foo --> |
| 69 | + |
| 70 | +```js foo |
| 71 | +const foo = function (bar) { |
| 72 | + return bar++; |
| 73 | +}; |
| 74 | +``` |
| 75 | + |
| 76 | +```diff jsx:src/App.js |
| 77 | +function App() { |
| 78 | + const [count, setCount] = useState(0); |
| 79 | + |
| 80 | + return ( |
| 81 | + <div className="App"> |
| 82 | +- 👆 should not be empty here |
| 83 | ++ <h1>Counter App 🧮</h1> |
| 84 | ++ <button> |
| 85 | ++ + |
| 86 | ++ </button> |
| 87 | ++ <h3>{count} times clicked!🖱</h3> |
| 88 | + </div> |
| 89 | + ); |
| 90 | +} |
| 91 | + |
| 92 | +export default App; |
| 93 | +``` |
| 94 | + |
| 95 | +```vue:index.vue |
| 96 | +<template> |
| 97 | + <div class="todo"> |
| 98 | + <h1>TODO APP</h1> |
| 99 | + </div> |
| 100 | +</template> |
| 101 | +
|
| 102 | +<script lang="ts"> |
| 103 | +import { defineComponent } from 'vue'; |
| 104 | +
|
| 105 | +export default defineComponent({ |
| 106 | + name: 'Todo', |
| 107 | +}); |
| 108 | +</script> |
| 109 | +``` |
| 110 | + |
| 111 | +```Dockerfile:Dockerfile |
| 112 | +FROM ubuntu |
| 113 | +ENV name value # comment |
| 114 | +ENV name=value |
| 115 | +CMD ["echo", "$name"] |
| 116 | +``` |
| 117 | + |
| 118 | +```bash:foo.fish |
| 119 | +bind -M $mode \cq foo |
| 120 | +``` |
| 121 | + |
| 122 | +```diff |
| 123 | +@@ -4,6 +4,5 @@ |
| 124 | +- let foo = bar.baz([1, 2, 3]); |
| 125 | +- foo = foo + 1; |
| 126 | ++ const foo = bar.baz([1, 2, 3]) + 1; |
| 127 | + console.log(`foo: ${foo}`); |
| 128 | +``` |
| 129 | + |
| 130 | +```diff |
| 131 | +@@ -4,6 +4,5 @@ |
| 132 | +- let foo = bar.baz([1, 2, 3]); |
| 133 | +- foo = foo + 1; |
| 134 | ++ const foo = bar.baz([1, 2, 3]) + 1; |
| 135 | + console.log(`foo: ${foo}`); |
| 136 | +``` |
| 137 | + |
| 138 | +```js diff:diff with looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong lang |
| 139 | +@@ -4,6 +4,5 @@ |
| 140 | +- let foo = bar.baz([1, 2, 3]); |
| 141 | +- foo = foo + 1; |
| 142 | ++ const foo = bar.baz([1, 2, 3]) + 1; |
| 143 | + console.log(`foo: ${foo}`); |
| 144 | +``` |
| 145 | + |
| 146 | +```js diff:diff with lang |
| 147 | +@@ -4,6 +4,5 @@ |
| 148 | +- let foo = bar.baz([1, 2, 3]); |
| 149 | +- foo = foo + 1; |
| 150 | ++ const foo = bar.baz([1, 2, 3]) + 1; |
| 151 | + console.log(`foo: ${foo}`); |
| 152 | +``` |
| 153 | + |
| 154 | +```diff js:diff with lang |
| 155 | +@@ -4,6 +4,5 @@ |
| 156 | +- let foo = bar.baz([1, 2, 3]); |
| 157 | +- foo = foo + 1; |
| 158 | ++ const foo = bar.baz([1, 2, 3]) + 1; |
| 159 | + console.log(`foo: ${foo}`); |
| 160 | +``` |
| 161 | + |
| 162 | +```js:fooBar.js |
| 163 | +var foo = function (bar) { |
| 164 | + return bar++; |
| 165 | +}; |
| 166 | + |
| 167 | +console.log(foo(5)); |
| 168 | +// 👇can scroll horizontally |
| 169 | +console.log(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); |
| 170 | +``` |
| 171 | + |
| 172 | +```js:example |
| 173 | +var foo = function (bar) { |
| 174 | + return bar++; |
| 175 | +}; |
| 176 | +``` |
| 177 | + |
| 178 | +```html:<should escape> |
| 179 | +var foo = function (bar) { |
| 180 | + return bar++; |
| 181 | +}; |
| 182 | +``` |
| 183 | + |
| 184 | +```html |
| 185 | +<div>a</div> |
| 186 | +``` |
| 187 | + |
| 188 | +```diff html:html差分 |
| 189 | + <div>a</div> |
| 190 | +- <div>b</div> |
| 191 | ++ <div>c</div> |
| 192 | +``` |
| 193 | + |
| 194 | +```html diff : html差分 |
| 195 | +<div>a</div> |
| 196 | +- |
| 197 | +<div>b</div> |
| 198 | ++ |
| 199 | +<div>c</div> |
| 200 | +``` |
| 201 | + |
| 202 | +```"><img/onerror="alert(location)"src=.> |
| 203 | +"><img/onerror="alert(location)"src=.> |
| 204 | +``` |
0 commit comments