From 3e9396c319ad4311b259834c7852423fc74b763e Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Thu, 20 Feb 2025 22:20:30 -0500 Subject: [PATCH] [new] Support literate Djot files Djot is a markup format that is derived from CommonMark, it's code block syntax is identical to CommonMark's, so we can support it as a CommonMark style literate formate by just adding the file extension. --- CHANGELOG_NEXT.md | 3 +++ CONTRIBUTORS | 1 + docs/source/reference/literate.rst | 2 +- src/Parser/Unlit.idr | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG_NEXT.md b/CHANGELOG_NEXT.md index 0e22fb81ba..8b835501e4 100644 --- a/CHANGELOG_NEXT.md +++ b/CHANGELOG_NEXT.md @@ -122,6 +122,9 @@ This CHANGELOG describes the merged but unreleased changes. Please see [CHANGELO with `_builtin.` (eg `_builtin.CONS`). This allows the identity optimisation to optimise conversions between list-shaped things. +* [Djot](https://djot.net/) files can now be compiled as CommonMark style + Literate Idris files. + ### Backend changes #### RefC Backend diff --git a/CONTRIBUTORS b/CONTRIBUTORS index e5e12b037a..b5b5e4bed9 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -56,6 +56,7 @@ Michael Morgan Milan Kral Molly Miller Mounir Boudia +Nathan McCarty Nick Drozd Nicolas Biri Niklas Larsson diff --git a/docs/source/reference/literate.rst b/docs/source/reference/literate.rst index 92cdccd30a..8d57b9c63e 100644 --- a/docs/source/reference/literate.rst +++ b/docs/source/reference/literate.rst @@ -86,7 +86,7 @@ Each of the following markup is recognised regardless of case: CommonMark ********** -We treat files with an extension of ``.md`` and ``.markdown`` as CommonMark style literate files. +We treat Markdown files with an extension of ``.md`` or ``.markdown`` and Djot files with an extension of ``.dj`` as CommonMark style literate files. + CommonMark source blocks for idris sans options are recognised as visible code blocks:: diff --git a/src/Parser/Unlit.idr b/src/Parser/Unlit.idr index 0581e620bd..2d3ec81f69 100644 --- a/src/Parser/Unlit.idr +++ b/src/Parser/Unlit.idr @@ -33,7 +33,7 @@ styleCMark : LiterateStyle styleCMark = MkLitStyle [("```idris", "```"), ("~~~idris", "~~~"), ("")] Nil - [".md", ".markdown"] + [".md", ".markdown", ".dj"] export styleTeX : LiterateStyle