Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use .effekt.md for literate Effekt code #341

Merged
merged 8 commits into from
Dec 7, 2023

Conversation

marzipankaiser
Copy link
Contributor

@marzipankaiser marzipankaiser commented Dec 6, 2023

This mirrors effekt-lang/effekt-vscode#14, i.e.:

  • Use .effekt.md instead of plain .md for literate Effekt code.
  • Also changes the treatment of markdown files such that code fences that are explicitly labelled with something other than
    effekt (plus optional spaces) are ignored.
    I.e. valid (opening and closing) fence delimiters:
    ```
    ```effekt
    ``` effekt
    ```effekt :mymodifier
    ```effekt:mymodifier
    ```effekt timeout=12
    
    Ignored delimiters:
    ```tex
    ```myfancyotherlanguage
    ```effektcode
    ```eff
    

@marzipankaiser marzipankaiser changed the title Use .effekt.md for literate Effekt code Use .effekt.md for literate Effekt code Dec 6, 2023
Copy link
Contributor

@jiribenes jiribenes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@marzipankaiser
Copy link
Contributor Author

Note: In some of the case studies, we use something like

```
// output
```

To give the output of a function etc.
Using this PR, we could instead do:

```text
output
```

directly.

effekt/jvm/src/main/scala/effekt/Driver.scala Outdated Show resolved Hide resolved
@@ -10,17 +10,22 @@ import kiama.util.Source
*/
case class MarkdownSource(source: Source) extends Source {

val fenceLine = """^```[^`\n]*$""".r
val fenceLine = """^```\s*(effekt)?\s*((\s|:)[^`]*)?$""".r
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should. It does support the ones here:

```effekt:sketch:hide
module examples/casestudies/ad
```
```effekt:prelude:hide
import immutable/list
import mutable/heap
```

(which were the motivation behind allowing (\s|:)[^`]*)? there)

So I would be inclined to say yes, though I did not specifically test for them.

examples/casestudies/README.md Show resolved Hide resolved
@b-studios b-studios merged commit b8c278e into master Dec 7, 2023
2 checks passed
@b-studios b-studios deleted the feature/literal-effekt-with-effekt-md branch December 7, 2023 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants