Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# emgithub
# emgithub original info

https://emgithub.com/

Expand All @@ -8,6 +8,10 @@ Demo: <https://yusanshi.com/posts/2019-12-17/emgithub/> (scroll to the bottom of

![](https://user-images.githubusercontent.com/36265606/185886623-f5f5685d-1e99-43c8-8de2-085dd6954dd7.gif)

## This fork - "collapsible"

This fork allows you to add a parameter "Collapsible" to the script call, that wraps the displayed script output in `<details><summary>...</summary>...</details>` tags.

## Get started

There are two ways to use the service:
Expand Down
8 changes: 7 additions & 1 deletion embed-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
const showBorder = params.get("showBorder") === "on";
const showLineNumbers = params.get("showLineNumbers") === "on";
const showFileMeta = params.get("showFileMeta") === "on";
const collapsible = params.get("collapsible") === "open" || params.get("collapsible") === "closed";
const collapsibleOpen = params.get("collapsible") === "open";
const showFullPath = params.get("showFullPath") === "on";
const showCopy = params.get("showCopy") === "on";
const fetchFromJsDelivr = params.get("fetchFromJsDelivr") === "on";
Expand Down Expand Up @@ -299,6 +301,10 @@

<div class="emgithub-file emgithub-file-${isDarkStyle ? 'dark' : 'light'}"
style="display:none;${showBorder ? '' : 'border:0'}">
${collapsible ? `<details class="emgithub-details"${collapsibleOpen ? ' open':''}>
<summary class="emgithub-summary">
<a target="_blank" href="${fileURL}">${decodeURIComponent(showFullPath ? filePath : pathSplit[pathSplit.length - 1])}</a>
</summary>`:''}
<div class="file-data ${styleClassName}">
${type === 'code' ? `<div class="code-area">
${showCopy ? `<a class="copy-btn copy-btn-${isDarkStyle ? 'dark' : 'light'}" href="javascript:void(0)">Copy</a>`
Expand All @@ -318,7 +324,7 @@
delivered <span class="hide-in-phone">with ❤ </span>by <a target="_blank" href="${serviceProvider}">emgithub</a>
</div>`: ''
}

${collapsible ? `</details>`:''}
</div>

</div>
Expand Down