mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
docs: Force highlighter to work despite errors on snippets that it cannot parse
This commit is contained in:
parent
d8260a1e93
commit
693b88e5f8
@ -237,6 +237,7 @@ Examples
|
||||
Given the contract:
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.4.16 <0.9.0;
|
||||
|
@ -130,6 +130,7 @@ The use of **function modifiers** makes these
|
||||
restrictions highly readable.
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity ^0.8.4;
|
||||
@ -293,6 +294,7 @@ function finishes.
|
||||
will run even if the function explicitly returns.
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity ^0.8.4;
|
||||
|
@ -130,6 +130,7 @@ internal functions in libraries in order to implement
|
||||
custom types without the overhead of external function calls:
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.8 <0.9.0;
|
||||
|
@ -660,6 +660,7 @@ The following example shows how you can use ``require`` to check conditions on i
|
||||
and ``assert`` for internal error checking.
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.5.0 <0.9.0;
|
||||
|
@ -192,6 +192,7 @@ invalid bids.
|
||||
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity ^0.8.4;
|
||||
|
@ -226,6 +226,7 @@ The new code generator performs cleanup after any operation that can result in d
|
||||
For example:
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.8.1;
|
||||
|
@ -998,6 +998,7 @@ No:
|
||||
Yes:
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
|
||||
x = 3;
|
||||
x = 100 / 10;
|
||||
@ -1007,6 +1008,7 @@ Yes:
|
||||
No:
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
|
||||
x=3;
|
||||
x = 100/10;
|
||||
|
@ -122,6 +122,7 @@ top of them and iterate over that. For example, the code below implements an
|
||||
the ``sum`` function iterates over to sum all the values.
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.8 <0.9.0;
|
||||
|
@ -239,6 +239,7 @@ It is possible to query the balance of an address using the property ``balance``
|
||||
and to send Ether (in units of wei) to a payable address using the ``transfer`` function:
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
|
||||
address payable x = address(0x123);
|
||||
address myAddress = address(this);
|
||||
@ -535,6 +536,7 @@ quote a backslash character and then (without separator) the
|
||||
character sequence ``abcdef``.
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
|
||||
"\n\"\'\\abc\
|
||||
def"
|
||||
@ -641,6 +643,7 @@ be passed via and returned from external function calls.
|
||||
Function types are notated as follows:
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
|
||||
function (<parameter types>) {internal|external} [pure|view|payable] [returns (<return types>)]
|
||||
|
||||
|
@ -10,6 +10,7 @@ Ether Units
|
||||
A literal number can take a suffix of ``wei``, ``gwei`` or ``ether`` to specify a subdenomination of Ether, where Ether numbers without a postfix are assumed to be Wei.
|
||||
|
||||
.. code-block:: solidity
|
||||
:force:
|
||||
|
||||
assert(1 wei == 1);
|
||||
assert(1 gwei == 1e9);
|
||||
|
Loading…
Reference in New Issue
Block a user