aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorcontra-bit <liam@contra-bit.com>2023-04-26 17:22:54 +0200
committerGitHub <noreply@github.com>2023-04-26 11:22:54 -0400
commit58caf422e67c78f87327bc9b00f89083a2432940 (patch)
tree167350d8e18fd79d0541891ba638b381f80a03f2 /modules
parentc41bc4f1279c9e1e6e11d7b5fcfe7ef089fc7577 (diff)
downloadgitea-58caf422e67c78f87327bc9b00f89083a2432940.tar.gz
gitea-58caf422e67c78f87327bc9b00f89083a2432940.zip
Add .livemd as a markdown extension (#22730)
## Needs and benefits [Livebook](https://livebook.dev/) notebooks are used for code documentation and for deep dives and note-taking in the elixir ecosystem. Rendering these in these as Markdown on frogejo has many benefits, since livemd is a subset of markdown. Some of the benefits are: - New users of elixir and livebook are scared by unformated .livemd files, but are shown what they expect - Sharing a notebook is as easy as sharing a link, no need to install the software in order to see the results. [goldmark-meraid ](https://github.com/abhinav/goldmark-mermaid) is a mermaid-js parser already included in gitea. This makes the .livemd rendering integration feature complete. With this PR class diagrams, ER Diagrams, flow charts and much more will be rendered perfectly. With the additional functionality gitea will be an ideal tool for sharing resources with fellow software engineers working in the elixir ecosystem. Allowing the git forge to be used without needing to install any software. ## Feature Description This issue requests the .livemd extension to be added as a Markdown language extension. - `.livemd` is the extension of Livebook which is an Elixir version of Jupyter Notebook. - `.livemd` is` a subset of Markdown. This would require the .livemd to be recognized as a markdown file. The Goldmark the markdown parser should handle the parsing and rendering automatically. Here is the corresponding commit for GitHub linguist: https://github.com/github/linguist/pull/5672 Here is a sample page of a livemd file: https://github.com/github/linguist/blob/master/samples/Markdown/livebook.livemd ## Screenshots The first screenshot shows how github shows the sample .livemd in the browser. The second screenshot shows how mermaid js, renders my development notebook and its corresponding ER Diagram. The source code can be found here: https://codeberg.org/lgh/Termi/src/commit/79615f74281789a1f2967b57bad0c67c356cef1f/termiNotes.livemd ## Testing I just changed the file extension from `.livemd`to `.md`and the document already renders perfectly on codeberg. Check you can it out [here](https://codeberg.org/lgh/Termi/src/branch/livemd2md/termiNotes.md) --------- Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'modules')
-rw-r--r--modules/setting/markup.go2
-rw-r--r--modules/setting/repository.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/modules/setting/markup.go b/modules/setting/markup.go
index 969e30e888..6c2246342b 100644
--- a/modules/setting/markup.go
+++ b/modules/setting/markup.go
@@ -33,7 +33,7 @@ var Markdown = struct {
}{
EnableHardLineBreakInComments: true,
EnableHardLineBreakInDocuments: false,
- FileExtensions: strings.Split(".md,.markdown,.mdown,.mkd", ","),
+ FileExtensions: strings.Split(".md,.markdown,.mdown,.mkd,.livemd", ","),
EnableMath: true,
}
diff --git a/modules/setting/repository.go b/modules/setting/repository.go
index bae3c658a4..20ed6d0dcd 100644
--- a/modules/setting/repository.go
+++ b/modules/setting/repository.go
@@ -168,7 +168,7 @@ var (
Editor: struct {
LineWrapExtensions []string
}{
- LineWrapExtensions: strings.Split(".txt,.md,.markdown,.mdown,.mkd,", ","),
+ LineWrapExtensions: strings.Split(".txt,.md,.markdown,.mdown,.mkd,.livemd,", ","),
},
// Repository upload settings