Skip to content

Commit

Permalink
fix layout & stop using <form>
Browse files Browse the repository at this point in the history
  • Loading branch information
not-my-profile authored and waldyrious committed Dec 12, 2022
1 parent 114ea5a commit 1b52690
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 21 deletions.
31 changes: 17 additions & 14 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@
<link rel="stylesheet" href="style.css" />
</head>
<body>
This is a demo of rendering reStructuredText (rST) to HTML entirely in the browser,
using <a href="https://pyodide.org">Pyodide</a>
to run <a href="https://docutils.sourceforge.io">docutils</a>.
Source code <a href="https://pyodide.org">on GitHub</a>.

<!-- <form oninput="html_output.value=rst_input.value"> -->
<form>
<label for="rst-input">reStructuredText input</label>
<label for="html-output">HTML output</label>
<textarea name="rst_input" id="rst-input"></textarea>
<iframe id="html-output"></iframe>
</form>
<button onclick="rstToHtml()">Run</button>

<p>
This is a demo of rendering reStructuredText (rST) to HTML entirely in the browser,
using <a href="https://pyodide.org">Pyodide</a>
to run <a href="https://docutils.sourceforge.io">docutils</a>.
Source code <a href="https://pyodide.org">on GitHub</a>.
</p>
<div class="form">
<div>
<label for="rst-input">reStructuredText input</label>
<textarea name="rst_input" id="rst-input"></textarea>
<button onclick="rstToHtml()">Run</button>
</div>
<div>
<label for="html-output">HTML output</label>
<iframe id="html-output" frameborder="0"></iframe>
<div>
</div>
<script src="script.js"></script>
</body>
</html>
23 changes: 16 additions & 7 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
form {
.form {
margin: 1em 0.5em;
display: grid;
grid-template-columns: calc((100% - 1em) / 2) calc((100% - 1em) / 2);
column-gap: 1em;
display: flex;
flex-grow: 1;
}
.form div {
display: flex;
flex-direction: column;
flex-grow: 1;
}
textarea, iframe {
border: 1px solid grey;
border-radius: 3px;
padding: 0.5em;
margin: 0;
display: block;
box-sizing: border-box;
width: 100%;
flex-grow: 1;
}
html, body {
height: 100%;
}
body {
display: flex;
flex-direction: column;
}

0 comments on commit 1b52690

Please sign in to comment.