We are looking for and considering whether we can change the format of the instructions from Excel to Markdown notation.
Step 4: Repeat Steps 1 through 3
Steps 1 through 3
cannot be automatically applied or I am having trouble writing.
Does anyone know any solutions or workarounds, such as plug-ins?
Below is the image of the instructions I want to create.
``markdown:before
1. Step A
1. Step B
1. Step C
1. Repeat [STEP1 something] ~ [STEP3 something] ◀ [ I want to put the title of the chapter in [STEP1 something]
```
⬇️
``markdown: after
1. Step A
2. Step B
3. Step C
4. Repeat steps A through C
```
My environment is as follows.
I searched for step repeat manual procedure markdown
in the search engine, but
No useful information was found.
Write a DRY Markdown was exactly the challenge I was facing.
Github
developer page was truncated...
Sorry for the inconvenience, but thank you for your cooperation.
markdown
There is an aesthetic problem, but what about the so-called template engine?
1.<%-first="Step A"%>
1. Step B
1.<%-last="Procedure C"%>
Repeat 1.<%-first%>~<%-last%>
The above and snippets use EJS.
If you're a programmer, you can barely use it.
function render(){
const md = ejs.render($src.value,{});
$markdown.textContent=md;
$html.innerHTML = marked(md);
}
</script>
h1{
font-size:1em;
}
textarea{
width: 100%;
height:20em;
}
pre,div{
color:black;
background:lightgray;
}
<!--Direct use of GitHub source for example, not available -->
<script src="https://github.com/mde/ejs/releases/download/v2.5.5/ejs.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.6/marked.min.js"></script>
<h1>Source (Markdown+EJS)</h1>
<textarea id="$src">
# variable
1.<%-first="Step A"%>
1. Step B
1.<%-last="Procedure C"%>
Repeat 1.<%-first%>~<%-last%>
---
# List/Repeat
<%
let list = ["Step A", "Step B", "Step C";
for (let li of list) {
-%>
1.<%-li%>
<%
}
-%>
1. Repeat <%-list[0]%>~<%-list[list.length-1]%>
</textarea>
<button onclick="render();">Conversion</button>
<h1>Markdown</h1>
<pred="$markdown"></pre>
<h1>HTML</h1>
<divid="$html"></div>
Have you tried R markdown?
http://rmarkdown.rstudio.com/
On a markdown basis, it seems to be quite useful for writing dynamic reports.
The original markdown can be expressed as follows:
``{python echo=FALSE, results='asis'}
manual = [
'Step A',
'Step B',
'Step C',
]
for i, man in enumerate (manual):
print("%d.%s"%(i+1,man))
print("Repeat %d.%s to %s"%(len(manual)+1, manual[0], manual[-1]))
```
The following is the procedure I printed in my environment (OSX Sierra + python 3 + markdown).
Pre-installed the knitr
package with R and
>install.packages(knitr)
Place the knit
script in the PATH as follows
#!/usr/local/bin/Rscript
library(knitr)
input<-readLines('stdin')
invisible(knit(text=input, output=stdout(), quiet=TRUE))
If you pass the markdown above to the pipe as test.md
, you will get the following results:
$cat test.md|knit2>/dev/null|markdown
<ol>
<li>Step A</li>
<li>Step B</li>
<li>Procedure C</li>
<li> Repeat steps A through C </li>
</ol>
© 2024 OneMinuteCode. All rights reserved.