Skip to content

Commit

Permalink
Improve README.md (#2)
Browse files Browse the repository at this point in the history
* Update README.md
* Embedding code into Markdown
  • Loading branch information
tokusumi committed Nov 17, 2020
1 parent 9e529ef commit 33892e3
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -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).


Expand All @@ -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`:
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 33892e3

Please sign in to comment.