Skip to content

Commit a317be4

Browse files
Merge pull request #1 from shafayetShafee/for-revealjs
Used some CSS to polish the output for revealjs
2 parents be2c5dd + 9a8c3f0 commit a317be4

File tree

88 files changed

+5652
-20
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+5652
-20
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,16 @@ You can use multiple databases too. Just list them under the `databases` key. Se
5858

5959
## Example
6060

61-
Here is the source code for a minimal example: [example.qmd](example.qmd).
61+
Here is the source code for,
6262

63+
- a minimal example for `html` format: [example.qmd](example.qmd).
64+
65+
- a minimal example for `revealjs` format: [example-revelajs.qmd](example-revealjs.qmd) and the [`rendered presentation`](https://shafayetshafee.github.io/interactive-sql/example-revealjs.html)
66+
67+
68+
## Limitation
69+
70+
One obvious limitation is that, if you use the `embed-resources` option, sql code will not run.
6371

6472
## Acknowledgement
6573

_extensions/interactive-sql/_extension.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
title: Interactive-sql
22
author: Shafayet Khan Shafee
3-
version: 1.0.1
3+
version: 1.0.2
44
quarto-required: ">=1.3.0"
55
contributes:
66
filters:

_extensions/interactive-sql/resources/css/interactive-sql.css

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
:root {
2+
--sqlime-font-family: Consolas, "Lucida Console", Monaco, monospace;
3+
--sqlime-font-size: 0.85em;
4+
--sqlime-line-height: 1;
5+
}
6+
17
.sqlime-example {
2-
font-family: Consolas, "Lucida Console", Monaco, monospace;
3-
font-size: 0.85em;
4-
line-height: 1;
8+
font-family: var(--sqlime-font-family);
9+
font-size: var(--sqlime-font-size);
10+
line-height: var(--sqlime-line-height);
511
}
612

713
.sqlime-example div:nth-child(1) {
@@ -14,6 +20,9 @@
1420
background-color: rgba(233,236,239,.30);
1521
border: 1px solid rgba(233,236,239,.30);
1622
border-radius: 0.25rem;
23+
max-width: 70em;
24+
max-height: 40em;
25+
overflow: auto;
1726
}
1827

1928
.sqlime-example table {
@@ -61,3 +70,44 @@
6170
.sqlime-example table tr:last-child td {
6271
padding-bottom: 0.8em;
6372
}
73+
74+
75+
/* For Revealjs */
76+
.reveal .sqlime-example button {
77+
cursor: pointer;
78+
border-radius: 0;
79+
background-color: white;
80+
margin: 0;
81+
font-family: inherit;
82+
font-size: calc(0.8*var(--sqlime-font-size));
83+
line-height: 1em;
84+
}
85+
86+
.reveal .sqlime-example a {
87+
font-family: var(--sqlime-font-family);
88+
font-size: calc(0.8*var(--sqlime-font-size));
89+
}
90+
91+
.reveal .sqlime-example table {
92+
font-family: var(--sqlime-font-family);
93+
font-size: calc(0.8*var(--sqlime-font-size));
94+
margin: 0;
95+
}
96+
97+
.reveal .sqlime-example table th {
98+
padding: 0.5em;
99+
}
100+
101+
.reveal .sqlime-example table td {
102+
border-bottom: none;
103+
}
104+
105+
.reveal .sqlime-example div:nth-child(2) {
106+
max-height: 8em;
107+
max-width: 30em;
108+
overflow: auto;
109+
}
110+
111+
.reveal .interactive-sql code[contenteditable="true"] {
112+
padding-left: 1em;
113+
}

_extensions/interactive-sql/resources/js/interactive-sql.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,19 @@
44
let sqlime_output = el.querySelector('div.sqlime-example');
55
el.appendChild(sqlime_output);
66
});
7+
8+
// for revealjs, removing the `numberSource` from <pre> from when
9+
// `contenteditable="true"` in <code>, so that line numbers doesnot show
10+
// up.
11+
12+
let reveal_sqldiv = document.querySelectorAll('.reveal div.interactive-sql');
13+
reveal_sqldiv.forEach(el => {
14+
let pre = el.querySelector('pre.sourceCode');
15+
let code = el.querySelector('code.sourceCode');
16+
if (code.hasAttribute('contenteditable')) {
17+
if (pre.classList.contains('numberSource')) {
18+
pre.classList.remove('numberSource');
19+
};
20+
};
21+
});
722
})();

0 commit comments

Comments
 (0)