From 2076cb4b6442976412193457ae57f3e23b1ad742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=A9lumire?= <31185220+Telumire@users.noreply.github.com> Date: Wed, 5 Jan 2022 17:07:15 +0100 Subject: [PATCH] Add files via upload --- files/copy-code-macro.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 files/copy-code-macro.json diff --git a/files/copy-code-macro.json b/files/copy-code-macro.json new file mode 100644 index 0000000..83ba768 --- /dev/null +++ b/files/copy-code-macro.json @@ -0,0 +1 @@ +[{"created":"20211027134000011","text":"<$list filter=\"[all[current]tag[$:/tags/Stylesheet]]\">\n<$reveal tag=\"div\" type=\"nomatch\" stateTitle=<> text=\"hide\">\n<$macrocall $name=\"copy-code\" language=css display-language=show code={{!!text}} />\n\n\n<$list filter=\"[all[current]tag[$:/tags/Macro]]\">\n<$reveal tag=\"div\" type=\"nomatch\" stateTitle=<> text=\"hide\">\n<$macrocall $name=\"copy-code\" language=\"text/vnd.tiddlywiki\" display-language=show code={{!!text}} />\n\n\n<$list filter=\"[all[current]tag[$:/tags/ViewTemplate]]\">\n<$reveal tag=\"div\" type=\"nomatch\" stateTitle=<> text=\"hide\">\n<$macrocall $name=\"copy-code\" language=\"text/vnd.tiddlywiki\" display-language=show code={{!!text}} />\n\n","tags":"$:/showInfo/macro/copy-code $:/tags/ViewTemplate bookmark","title":"$:/showInfo/code/Stylesheet/ViewTemplate","modified":"20211106034213105","type":"","list-before":"$:/core/ui/ViewTemplate/body"},{"created":"20210527202956234","text":"\\define copy-code(language:\"\" code:\"\" title:\"\" display-language:\"show\")\n
\n\t
<<__title__>>
\n\t
\n\t\t<$macrocall $name=\"copy-to-clipboard\" src=<<__code__>>/> \n\t\t<$codeblock code=<<__code__>> language=<<__language__>>/>\n\t\t>><<__language__>>\n\t
\n
\n\n\n\\end","title":"$:/showInfo/macro/copy-code","type":"text/vnd.tiddlywiki","creator":"user","list":"","modified":"20211105231519430","modifier":"user","tags":"$:/showInfo $:/tags/Macro $:/showInfo/macro/copy-code","tagging":"after"},{"created":"20210527204100789","text":";Default code block (without copy-to-clipboard) (syntax coloring provided by [[highlight.js|$:/plugins/tiddlywiki/highlight]])\n\n```html\n
    \n
  • Without title
  • \n
\n```\n\n;Basic macro call copy-code-to-clipboard alt-m\n\n<\n
  • Without title
  • \n\">>\n\n<\n
  • Without language indicator
  • \n\" \"\" hide>>\n\n<\n
  • default parameter order
  • \n\"\n\n\"Now with a title !\">>\n\n<\n
  • Specific parameter order
  • \n\"\n>>\n\n;~~Limitation : can't use <<>> inside a block of code with this technique, otherwise it breaks :~~\n> EDIT: the newer version of tiddlywiki no longer have this issue !\n\n<\n
  • Specific parameter order
  • <>\n\"\n>>\n\n;The full macrocall notation alt-shift-m prevent this issue :\n\n<$macrocall $name=\"copy-code\"\ntitle=\"Code sample\"\nlanguage=html\ndisplay-language=show\ncode=\"
      \n
    • This works !
    • <>\n
    \"\n/>","title":"$:/showInfo/macro/copy-code/examples","creator":"user","modified":"20220105145036165","modifier":"user","tags":"$:/showInfo/macro/copy-code"},{"created":"20210528014602259","text":"<$action-sendmessage\n $message=\"tm-edit-text-operation\"\n $param=\"wrap-selection\"\n prefix='<$macrocall $name=\"copy-code\"\ntitle=\"\"\nlanguage=\"\"\ndisplay-language=\"show\"\ncode=\"\"\"'\n\nsuffix='\"\"\"/>'\n/>","title":"$:/showInfo/macro/copy-code/shortcuts/full","caption":"shortcut copy code button with full macrocall syntax","condition":"[!has[type]] [type[text/vnd.tiddlywiki]]","creator":"user","description":"Transform the selection into a code bloc with a copy to clipboard button - allow double angle brackets","icon":"$:/core/images/copy-clipboard","modified":"20211027155009472","modifier":"user","shortcuts":"alt-shift-m","tags":"$:/tags/EditorToolbar $:/showInfo/macro/copy-code"},{"created":"20210527212751871","text":"<$action-sendmessage\n $message=\"tm-edit-text-operation\"\n $param=\"wrap-selection\"\n prefix='<","title":"$:/showInfo/macro/copy-code/shortcuts/short","caption":"shortcut copy code button","condition":"[!has[type]] [type[text/vnd.tiddlywiki]]","creator":"user","description":"Transform the selection into a code bloc with a copy to clipboard button","icon":"$:/core/images/copy-clipboard","modified":"20211027155009426","modifier":"user","shortcuts":"alt-m","tags":"$:/tags/EditorToolbar $:/showInfo/macro/copy-code"},{"created":"20210527214847395","text":".copy-code{\n font-family: Consolas;\n}\n\n.copy-code dt{\n background: <>;\n border: solid 1px <>;\n border-bottom:unset;\n padding: 0.5em;\n border-radius: 3px 3px 0 0;\n font-size: 1.1em;\n}\n\n.copy-code dt:empty, .copy-code dd small.hide{\n display: none;\n}\n\n.copy-code dd{\n margin: 0;\n}\n\n.copy-code dd>pre{\n border-radius: 3px;\n background-color:<>\n}\n\n.copy-code dt:not(:empty)+dd>pre{\n border-radius: 0 0 3px 3px;\n margin-top: 0em;\n}\n\n.copy-code dd{\n position: relative;\n display: block;\n}\n\n.copy-code dd :is(button, small) {\n position: absolute;\n opacity: 0.3;\n padding: 5px;\n}\n\n.copy-code dd button:hover{\n transition: opacity 150ms ease-in-out;\n opacity: 1;\n}\n\n.copy-code dd button {\n font-size: 0;\n right:0;\n display: flex;\n align-items:flex-start;\n justify-content:flex-end;\n pointer-events:none;\n}\n\n.copy-code dd button svg {\n width: 20px;\n height: auto;\n pointer-events:all;\n}\n\n.copy-code dd small {\n inset: auto 0 0 auto;\n text-transform: uppercase;\n font-weight: bold;\n font-size: 1em;\n}","title":"$:/showInfo/macro/copy-code/style","type":"text/vnd.tiddlywiki","creator":"user","modified":"20211115014106263","modifier":"user","tags":"$:/showInfo/macro/copy-code $:/tags/Stylesheet","comment":"<>"},{"created":"20211027143252536","text":"\\rules only\n:is([data-tags*=\"$:/tags/Stylesheet\"],[data-tags*=\"$:/tags/ViewTemplate\"],[data-tags*=\"$:/tags/Macro\"]) .tc-tiddler-body{\ndisplay:none;\n}","tags":"$:/showInfo/code/Stylesheet/ViewTemplate $:/showInfo/macro/copy-code/style $:/showInfo/macro/copy-code $:/tags/Stylesheet","title":"$:/showInfo/Stylesheet/Style","modified":"20211105234333491","hide-body":"yes","description":"remember to add the field `hide-body:yes` for better performances"}] \ No newline at end of file