You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# My Doc## Common Definitions```scala mdoc
deffoo=1```## Some Section```scala mdoc:reset
defbar=1```## Some Other Section```scala mdoc:reset
defbar=2```
Sometimes resets are necessary to reuse the same name (bar here). However, full resetting is too restrictive in some cases because I still want to be able to access foo (which also might have been shadowed in-between).
Proposal
One solution would be a scoping mechanism similiar to reset-object, but with the possibility to name the object.
# My Doc## Common Definitions```scala mdoc:reset-object:common
deffoo=1```## Some Section```scala mdoc:reset
importcommon._defbar=1+ foo
```## Some Other Section```scala mdoc:reset
importcommon._defbar=2* foo
```
In the above example the first code fence triggers an object definition, named common. The second code fence (by means of reset) closes the prior object definition. It imports foo as a member of common and uses it.
Use Case
When writing text books sometimes it is necessary to refer back to prior definitions while shadowing names in between.
The text was updated successfully, but these errors were encountered:
Imagine the following markdown document
Sometimes resets are necessary to reuse the same name (
bar
here). However, full resetting is too restrictive in some cases because I still want to be able to accessfoo
(which also might have been shadowed in-between).Proposal
One solution would be a scoping mechanism similiar to
reset-object
, but with the possibility to name the object.In the above example the first code fence triggers an object definition, named
common
. The second code fence (by means of reset) closes the prior object definition. It importsfoo
as a member ofcommon
and uses it.Use Case
When writing text books sometimes it is necessary to refer back to prior definitions while shadowing names in between.
The text was updated successfully, but these errors were encountered: