Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
theo-armour committed Nov 17, 2023
1 parent 21ba678 commit 8dab248
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cookbook/copilot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ What is the URL that obtains the list of only the homepage URLs for all GitHub r
Can you build a webpage that obtains the list of all GitHub repositories for a user and only displays the links to the "html_url"?

Can you build a webpage that obtains the list of all GitHub organizations for a user and only displays the links to the "html_url"?

Can you help me select a Markdown file on my computer, open it, and let me edit it?
56 changes: 56 additions & 0 deletions cookbook/copilot/edit-markdown.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>

<body>
<input type="file" id="fileInput" accept=".md">
<div id="fileContent" contentEditable="true"></div>
<button id="saveButton">Save as Markdown</button>

<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/turndown/dist/turndown.js"></script>
<script>
marked.setOptions( {
gfm: true
} );

document.getElementById( 'fileInput' ).addEventListener( 'change', function ( e ) {
const file = e.target.files[ 0 ];
if ( !file ) {
return;
}
const reader = new FileReader();

reader.onload = function ( e ) {
const markdown = e.target.result;
const html = marked.parse( markdown );
document.getElementById( 'fileContent' ).innerHTML = html;
};
reader.readAsText( file );
} );

document.getElementById( 'saveButton' ).addEventListener( 'click', function () {
const turndownService = new TurndownService();
turndownService.addRule( 'headings', {
filter: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],
replacement: function ( content, node ) {
var hLevel = node.nodeName.charAt( 1 );
var hashes = '';
for ( var i = 0; i < hLevel; i++ ) {
hashes += '#';
}
return '\n\n' + hashes + ' ' + content + '\n\n';
}
} );
const html = document.getElementById( 'fileContent' ).innerHTML;
const markdown = turndownService.turndown( html );
const blob = new Blob( [ markdown ], { type: 'text/plain' } );
const url = URL.createObjectURL( blob );
const a = document.createElement( 'a' );
a.href = url;
a.download = 'file.md';
a.click();
} );
</script>
</body>

</html>
21 changes: 21 additions & 0 deletions cookbook/copilot/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Markdown

123 456 789

ABC def ghi hhhhh iiiiiiiiii

## Things we design

* [https://jaanga.github.io/moving-manuals/](https://jaanga.github.io/moving-manuals/)
* More
* mmm
* nnn nnnnnnnnnnnnn
* [http://wikihouse.github.io/viewer-experiments/](http://wikihouse.github.io/viewer-experiments/)
* [https://opendesk.github.io/design-playground/](https://opendesk.github.io/design-playground/)
* [https://jaanga.github.io/demo/alexi-k/](https://jaanga.github.io/demo/alexi-k/)
* [https://jaanga.github.io/demo/unlimbited/unlimbited-forearm-r2.html](https://jaanga.github.io/demo/unlimbited/unlimbited-forearm-r2.html)
* [https://jaanga.github.io/gestification/projects/flying-leap-3d/barfolina-pavillion/r3/barfolina-pavillion.html](https://jaanga.github.io/gestification/projects/flying-leap-3d/barfolina-pavillion/r3/barfolina-pavillion.html)

lorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur?

lorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur?

0 comments on commit 8dab248

Please sign in to comment.