From 33892e3daec903c553293e11193ae6ef3e348d77 Mon Sep 17 00:00:00 2001 From: "T. Tokusumi" <41147016+tokusumi@users.noreply.github.com> Date: Wed, 18 Nov 2020 00:08:20 +0900 Subject: [PATCH] Improve README.md (#2) * Update README.md * Embedding code into Markdown --- README.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f5db7a8..e2cf996 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Readme code testing example +![Test code and embed into README](https://github.com/tokusumi/readme-code-testing/workflows/Test%20code%20and%20embed%20into%20README/badge.svg) + + This repo demonstrates [Markdown Embed Code From File](https://github.com/marketplace/actions/markdown-embed-code-from-file) (GitHub Action). @@ -11,7 +14,7 @@ You could put code in external file and test them, as same as ordinary testing y ## Mark your code for embedding -This action could inspect your code, if you add a file path in code block as "`lang:external/file/path.py`". +This action could inspect your code, if you add a file path in code block as "\`\`\`lang:external/file/path.py\`\`\`". The following code block has a file path `src/helloworld.py`: @@ -22,18 +25,19 @@ def hello(): return "world" ``` -See in [src/helloworld.py]() as: +See with [src/helloworld.py]() as: -* The code is synchronized. -* The code is highlighting in readme +* Synchronized code. +* Highlighting code in readme. +* Not affected code rendering. -And notice that nothing to do re-embedding new/modified code. +And notice that nothing to do re-embedding new/modified code. This action overrides code if you change code in external file. ### Multiple use -You might add one file path (ex. [src/mul.py]())for multiple code blocks: +You might add one file path (ex. [src/mul.py]()) for multiple code blocks: ```py:src/mul.py @@ -66,7 +70,7 @@ Notice that this action goes to "fail" if a file you add does not exist. This action could work for any programming "language". -Ideally you could write as "`lang:external/file/path.py`", but actually this action does not inspect "lang", just read path and copy&paste strings into target code block in markdown. +Ideally you could write as "\`\`\`lang:external/file/path.py\`\`\`", but actually this action does not inspect "lang", just read path and copy&paste strings into target code block in markdown. So, missing "lang" is available: